From bd23a47652031cd48c4210a1f48fa8ec846389ab Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Wed, 3 Jun 2026 13:24:59 +0100 Subject: [PATCH 1/2] Fix clash between match_cond variable and local variable --- cpp2rust/converter/converter.cpp | 4 ++-- tests/unit/switch_basic.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp2rust/converter/converter.cpp b/cpp2rust/converter/converter.cpp index f6659976..d5940eaa 100644 --- a/cpp2rust/converter/converter.cpp +++ b/cpp2rust/converter/converter.cpp @@ -3105,7 +3105,7 @@ bool Converter::ConvertSwitchCaseCondition(clang::SwitchCase *stmt) { while (auto *sc = clang::dyn_cast(cur)) { if (auto *case_stmt = clang::dyn_cast(sc)) { if (!first) { - StrCat("|| v == "); + StrCat("|| __v == "); } Convert(case_stmt->getLHS()); } @@ -3127,7 +3127,7 @@ void Converter::EmitSwitchArm(clang::CompoundStmt *body, clang::SwitchCase *sc, if (is_default) { StrCat("_ => {"); } else { - StrCat("v if v == "); + StrCat("__v if __v == "); ConvertSwitchCaseCondition(sc); } for (auto *t : GetSwitchCaseBody(body, sc)) { diff --git a/tests/unit/switch_basic.cpp b/tests/unit/switch_basic.cpp index 49a4af91..490d9ed1 100644 --- a/tests/unit/switch_basic.cpp +++ b/tests/unit/switch_basic.cpp @@ -2,6 +2,7 @@ int basic(int x) { int r = 0; + int v = 0; // this should not clash with the match_cond translated variable switch (x) { case 0: r = 10; From ac15df90fd4bd6a11a4e840ddfd503c8c626a38c Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Wed, 3 Jun 2026 15:27:04 +0100 Subject: [PATCH 2/2] Update tests --- tests/unit/out/refcount/assign_as_value.rs | 2 +- tests/unit/out/refcount/enum_int_interop.rs | 20 +++++++++---------- tests/unit/out/refcount/enum_int_interop_c.rs | 20 +++++++++---------- tests/unit/out/refcount/goto_cleanup.rs | 2 +- .../out/refcount/goto_switch_fallthrough.rs | 4 ++-- tests/unit/out/refcount/switch_basic.rs | 7 ++++--- .../switch_borrow_in_condition_and_in_body.rs | 2 +- .../out/refcount/switch_case_then_default.rs | 2 +- .../switch_cases_and_default_stacked.rs | 2 +- tests/unit/out/refcount/switch_char.rs | 8 ++++---- .../unit/out/refcount/switch_complex_cond.rs | 6 +++--- .../out/refcount/switch_compound_case_body.rs | 4 ++-- .../refcount/switch_continue_inside_switch.rs | 2 +- .../unit/out/refcount/switch_default_first.rs | 4 ++-- .../out/refcount/switch_default_middle.rs | 4 ++-- .../out/refcount/switch_default_then_case.rs | 4 ++-- .../refcount/switch_empty_case_with_break.rs | 4 ++-- tests/unit/out/refcount/switch_enum.rs | 6 +++--- .../out/refcount/switch_fallthrough_chain.rs | 8 ++++---- .../refcount/switch_fallthrough_default.rs | 2 +- .../refcount/switch_fallthrough_into_block.rs | 4 ++-- .../out/refcount/switch_fallthrough_one.rs | 4 ++-- .../refcount/switch_for_in_switch_break.rs | 2 +- .../refcount/switch_for_in_switch_continue.rs | 2 +- .../refcount/switch_for_switch_for_break.rs | 2 +- tests/unit/out/refcount/switch_in_dowhile.rs | 4 ++-- tests/unit/out/refcount/switch_in_loop.rs | 4 ++-- .../refcount/switch_mixed_literal_cases.rs | 8 ++++---- .../out/refcount/switch_mixed_return_break.rs | 6 +++--- tests/unit/out/refcount/switch_nested.rs | 8 ++++---- tests/unit/out/refcount/switch_no_default.rs | 4 ++-- .../unit/out/refcount/switch_on_assignment.rs | 4 ++-- tests/unit/out/refcount/switch_on_call.rs | 6 +++--- tests/unit/out/refcount/switch_stacked.rs | 4 ++-- .../unit/out/refcount/switch_stacked_block.rs | 2 +- .../switch_stacked_with_inner_fallthrough.rs | 2 +- .../refcount/switch_while_in_switch_break.rs | 2 +- .../out/refcount/va_arg_non_primitive_ptrs.rs | 8 ++++---- tests/unit/out/unsafe/assign_as_value.rs | 2 +- tests/unit/out/unsafe/enum_int_interop.rs | 20 +++++++++---------- tests/unit/out/unsafe/enum_int_interop_c.rs | 20 +++++++++---------- tests/unit/out/unsafe/goto_cleanup.rs | 2 +- .../out/unsafe/goto_switch_fallthrough.rs | 4 ++-- tests/unit/out/unsafe/switch_basic.rs | 7 ++++--- .../switch_borrow_in_condition_and_in_body.rs | 2 +- .../out/unsafe/switch_case_then_default.rs | 2 +- .../switch_cases_and_default_stacked.rs | 2 +- tests/unit/out/unsafe/switch_char.rs | 8 ++++---- tests/unit/out/unsafe/switch_complex_cond.rs | 6 +++--- .../out/unsafe/switch_compound_case_body.rs | 4 ++-- .../unsafe/switch_continue_inside_switch.rs | 2 +- tests/unit/out/unsafe/switch_default_first.rs | 4 ++-- .../unit/out/unsafe/switch_default_middle.rs | 4 ++-- .../out/unsafe/switch_default_then_case.rs | 4 ++-- .../unsafe/switch_empty_case_with_break.rs | 4 ++-- tests/unit/out/unsafe/switch_enum.rs | 6 +++--- .../out/unsafe/switch_fallthrough_chain.rs | 8 ++++---- .../out/unsafe/switch_fallthrough_default.rs | 2 +- .../unsafe/switch_fallthrough_into_block.rs | 4 ++-- .../unit/out/unsafe/switch_fallthrough_one.rs | 4 ++-- .../out/unsafe/switch_for_in_switch_break.rs | 2 +- .../unsafe/switch_for_in_switch_continue.rs | 2 +- .../out/unsafe/switch_for_switch_for_break.rs | 2 +- tests/unit/out/unsafe/switch_in_dowhile.rs | 4 ++-- tests/unit/out/unsafe/switch_in_loop.rs | 4 ++-- .../out/unsafe/switch_mixed_literal_cases.rs | 8 ++++---- .../out/unsafe/switch_mixed_return_break.rs | 6 +++--- tests/unit/out/unsafe/switch_nested.rs | 8 ++++---- tests/unit/out/unsafe/switch_no_default.rs | 4 ++-- tests/unit/out/unsafe/switch_on_assignment.rs | 4 ++-- tests/unit/out/unsafe/switch_on_call.rs | 6 +++--- tests/unit/out/unsafe/switch_stacked.rs | 4 ++-- tests/unit/out/unsafe/switch_stacked_block.rs | 2 +- .../switch_stacked_with_inner_fallthrough.rs | 2 +- .../unsafe/switch_while_in_switch_break.rs | 2 +- .../out/unsafe/union_void_ptr_sized_deref.rs | 6 +++--- .../out/unsafe/va_arg_non_primitive_ptrs.rs | 8 ++++---- 77 files changed, 193 insertions(+), 191 deletions(-) diff --git a/tests/unit/out/refcount/assign_as_value.rs b/tests/unit/out/refcount/assign_as_value.rs index 5352d3da..bf16523b 100644 --- a/tests/unit/out/refcount/assign_as_value.rs +++ b/tests/unit/out/refcount/assign_as_value.rs @@ -33,7 +33,7 @@ fn main_0() -> i32 { (*out.borrow()) }) as i32); match __match_cond { - v if v == ('x' as i32) => { + __v if __v == ('x' as i32) => { assert!((1 != 0)); break 'switch; } diff --git a/tests/unit/out/refcount/enum_int_interop.rs b/tests/unit/out/refcount/enum_int_interop.rs index 930587cc..3354d952 100644 --- a/tests/unit/out/refcount/enum_int_interop.rs +++ b/tests/unit/out/refcount/enum_int_interop.rs @@ -116,16 +116,16 @@ pub fn classify_option_5(option: i32) -> i32 { 'switch: { let __match_cond = (*option.borrow()); match __match_cond { - v if v == (Option::OPT_NONE as i32) => { + __v if __v == (Option::OPT_NONE as i32) => { return -1_i32; } - v if v == (Option::OPT_A as i32) => { + __v if __v == (Option::OPT_A as i32) => { return 1; } - v if v == (Option::OPT_B as i32) => { + __v if __v == (Option::OPT_B as i32) => { return 2; } - v if v == (Option::OPT_C as i32) => { + __v if __v == (Option::OPT_C as i32) => { return 3; } _ => { @@ -153,13 +153,13 @@ fn main_0() -> i32 { 'switch: { let __match_cond = ((*c.borrow()) as i32); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { break 'switch; } - v if v == 1 => { + __v if __v == 1 => { return 1; } - v if v == 2 => { + __v if __v == 2 => { return 2; } _ => { @@ -215,13 +215,13 @@ fn main_0() -> i32 { 'switch: { let __match_cond = ((*t.borrow()) as i32); match __match_cond { - v if v == (Tag::TAG_ZERO as i32) => { + __v if __v == (Tag::TAG_ZERO as i32) => { return 90; } - v if v == 1 => { + __v if __v == 1 => { return 91; } - v if v == 2 => { + __v if __v == 2 => { break 'switch; } _ => {} diff --git a/tests/unit/out/refcount/enum_int_interop_c.rs b/tests/unit/out/refcount/enum_int_interop_c.rs index 572dfce3..817170c6 100644 --- a/tests/unit/out/refcount/enum_int_interop_c.rs +++ b/tests/unit/out/refcount/enum_int_interop_c.rs @@ -106,16 +106,16 @@ pub fn classify_option_5(option: i32) -> i32 { 'switch: { let __match_cond = (*option.borrow()); match __match_cond { - v if v == (Option::OPT_NONE as i32) => { + __v if __v == (Option::OPT_NONE as i32) => { return -1_i32; } - v if v == (Option::OPT_A as i32) => { + __v if __v == (Option::OPT_A as i32) => { return 1; } - v if v == (Option::OPT_B as i32) => { + __v if __v == (Option::OPT_B as i32) => { return 2; } - v if v == (Option::OPT_C as i32) => { + __v if __v == (Option::OPT_C as i32) => { return 3; } _ => { @@ -143,13 +143,13 @@ fn main_0() -> i32 { 'switch: { let __match_cond = ((*c.borrow()) as u32); match __match_cond { - v if v == (0 as u32) => { + __v if __v == (0 as u32) => { break 'switch; } - v if v == (1 as u32) => { + __v if __v == (1 as u32) => { return 1; } - v if v == (2 as u32) => { + __v if __v == (2 as u32) => { return 2; } _ => { @@ -209,13 +209,13 @@ fn main_0() -> i32 { 'switch: { let __match_cond = ((*t.borrow()) as u32); match __match_cond { - v if v == ((Tag_enum::TAG_ZERO as i32) as u32) => { + __v if __v == ((Tag_enum::TAG_ZERO as i32) as u32) => { return 90; } - v if v == (1 as u32) => { + __v if __v == (1 as u32) => { return 91; } - v if v == (2 as u32) => { + __v if __v == (2 as u32) => { break 'switch; } _ => {} diff --git a/tests/unit/out/refcount/goto_cleanup.rs b/tests/unit/out/refcount/goto_cleanup.rs index a44fb20f..4ba868ee 100644 --- a/tests/unit/out/refcount/goto_cleanup.rs +++ b/tests/unit/out/refcount/goto_cleanup.rs @@ -56,7 +56,7 @@ pub fn from_switch_2(n: i32) -> i32 { 'switch: { let __match_cond = (*n.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { (*ret.borrow_mut()) = 10; goto!('out); } diff --git a/tests/unit/out/refcount/goto_switch_fallthrough.rs b/tests/unit/out/refcount/goto_switch_fallthrough.rs index 74581ceb..68d74f8d 100644 --- a/tests/unit/out/refcount/goto_switch_fallthrough.rs +++ b/tests/unit/out/refcount/goto_switch_fallthrough.rs @@ -13,10 +13,10 @@ pub fn sm_0(n: i32) -> i32 { '__entry: { *ret.borrow_mut() = 0; switch!(match (*n.borrow()) { - v if v == 0 => { + __v if __v == 0 => { (*ret.borrow_mut()) += 1; } - v if v == 1 => { + __v if __v == 1 => { (*ret.borrow_mut()) += 10; goto!('out); } diff --git a/tests/unit/out/refcount/switch_basic.rs b/tests/unit/out/refcount/switch_basic.rs index 6e224dbf..38b3b7d7 100644 --- a/tests/unit/out/refcount/switch_basic.rs +++ b/tests/unit/out/refcount/switch_basic.rs @@ -9,18 +9,19 @@ use std::rc::{Rc, Weak}; pub fn basic_0(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); let r: Value = Rc::new(RefCell::new(0)); + let v: Value = Rc::new(RefCell::new(0)); 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { (*r.borrow_mut()) = 10; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 20; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 30; break 'switch; } diff --git a/tests/unit/out/refcount/switch_borrow_in_condition_and_in_body.rs b/tests/unit/out/refcount/switch_borrow_in_condition_and_in_body.rs index a7272ca8..7bb749f0 100644 --- a/tests/unit/out/refcount/switch_borrow_in_condition_and_in_body.rs +++ b/tests/unit/out/refcount/switch_borrow_in_condition_and_in_body.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; pub fn borrow_in_condition_and_in_body_0(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); switch!(match (*x.borrow()) { - v if v == 0 => {} + __v if __v == 0 => {} _ => { return ((*x.borrow()) + 1); } diff --git a/tests/unit/out/refcount/switch_case_then_default.rs b/tests/unit/out/refcount/switch_case_then_default.rs index 6c58a070..fe82b175 100644 --- a/tests/unit/out/refcount/switch_case_then_default.rs +++ b/tests/unit/out/refcount/switch_case_then_default.rs @@ -12,7 +12,7 @@ pub fn case_then_default_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 20; break 'switch; } diff --git a/tests/unit/out/refcount/switch_cases_and_default_stacked.rs b/tests/unit/out/refcount/switch_cases_and_default_stacked.rs index b7ca14b1..4b5765ec 100644 --- a/tests/unit/out/refcount/switch_cases_and_default_stacked.rs +++ b/tests/unit/out/refcount/switch_cases_and_default_stacked.rs @@ -12,7 +12,7 @@ pub fn cases_and_default_stacked_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 3 => { + __v if __v == 3 => { (*r.borrow_mut()) = 3; break 'switch; } diff --git a/tests/unit/out/refcount/switch_char.rs b/tests/unit/out/refcount/switch_char.rs index 9a9fd82b..59128d68 100644 --- a/tests/unit/out/refcount/switch_char.rs +++ b/tests/unit/out/refcount/switch_char.rs @@ -11,16 +11,16 @@ pub fn switch_char_0(c: u8) -> i32 { 'switch: { let __match_cond = ((*c.borrow()) as i32); match __match_cond { - v if v == (('a' as u8) as i32) => { + __v if __v == (('a' as u8) as i32) => { return 1; } - v if v == (('b' as u8) as i32) => { + __v if __v == (('b' as u8) as i32) => { return 2; } - v if v == (('\n' as u8) as i32) => { + __v if __v == (('\n' as u8) as i32) => { return 3; } - v if v == (('\0' as u8) as i32) => { + __v if __v == (('\0' as u8) as i32) => { return 4; } _ => { diff --git a/tests/unit/out/refcount/switch_complex_cond.rs b/tests/unit/out/refcount/switch_complex_cond.rs index 141dce73..0d7496ac 100644 --- a/tests/unit/out/refcount/switch_complex_cond.rs +++ b/tests/unit/out/refcount/switch_complex_cond.rs @@ -15,13 +15,13 @@ pub fn switch_complex_cond_0(p: Ptr, bias: i32) -> i32 { _lhs + (*bias.borrow()) }; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 1; } - v if v == 5 => { + __v if __v == 5 => { return 2; } - v if v == 10 => { + __v if __v == 10 => { return 3; } _ => { diff --git a/tests/unit/out/refcount/switch_compound_case_body.rs b/tests/unit/out/refcount/switch_compound_case_body.rs index 5cb753c7..3fe3e0b5 100644 --- a/tests/unit/out/refcount/switch_compound_case_body.rs +++ b/tests/unit/out/refcount/switch_compound_case_body.rs @@ -12,13 +12,13 @@ pub fn compound_case_body_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { let y: Value = Rc::new(RefCell::new(10)); let z: Value = Rc::new(RefCell::new(20)); (*r.borrow_mut()) = ((*y.borrow()) + (*z.borrow())); break 'switch; } - v if v == 2 => { + __v if __v == 2 => { let y: Value = Rc::new(RefCell::new(100)); (*r.borrow_mut()) = ((*y.borrow()) - 1); break 'switch; diff --git a/tests/unit/out/refcount/switch_continue_inside_switch.rs b/tests/unit/out/refcount/switch_continue_inside_switch.rs index 4cc45fb4..c2929f6d 100644 --- a/tests/unit/out/refcount/switch_continue_inside_switch.rs +++ b/tests/unit/out/refcount/switch_continue_inside_switch.rs @@ -14,7 +14,7 @@ pub fn continue_inside_switch_0(n: i32) -> i32 { 'switch: { let __match_cond = (*i.borrow()); match __match_cond { - v if v == 0 || v == 2 || v == 4 => { + __v if __v == 0 || __v == 2 || __v == 4 => { (*i.borrow_mut()).prefix_inc(); continue 'loop_; } diff --git a/tests/unit/out/refcount/switch_default_first.rs b/tests/unit/out/refcount/switch_default_first.rs index d3591a5c..378329b3 100644 --- a/tests/unit/out/refcount/switch_default_first.rs +++ b/tests/unit/out/refcount/switch_default_first.rs @@ -12,11 +12,11 @@ pub fn default_first_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_default_middle.rs b/tests/unit/out/refcount/switch_default_middle.rs index 309a54d8..cdcd173a 100644 --- a/tests/unit/out/refcount/switch_default_middle.rs +++ b/tests/unit/out/refcount/switch_default_middle.rs @@ -12,11 +12,11 @@ pub fn default_middle_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_default_then_case.rs b/tests/unit/out/refcount/switch_default_then_case.rs index abaacb07..7ae25e2a 100644 --- a/tests/unit/out/refcount/switch_default_then_case.rs +++ b/tests/unit/out/refcount/switch_default_then_case.rs @@ -12,11 +12,11 @@ pub fn default_then_case_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 1; break 'switch; } - v if v == 3 => { + __v if __v == 3 => { (*r.borrow_mut()) = 3; break 'switch; } diff --git a/tests/unit/out/refcount/switch_empty_case_with_break.rs b/tests/unit/out/refcount/switch_empty_case_with_break.rs index 6b9ea970..60ae9b72 100644 --- a/tests/unit/out/refcount/switch_empty_case_with_break.rs +++ b/tests/unit/out/refcount/switch_empty_case_with_break.rs @@ -12,10 +12,10 @@ pub fn empty_case_with_break_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_enum.rs b/tests/unit/out/refcount/switch_enum.rs index fcdb6d4e..661b305b 100644 --- a/tests/unit/out/refcount/switch_enum.rs +++ b/tests/unit/out/refcount/switch_enum.rs @@ -29,13 +29,13 @@ pub fn switch_enum_0(c: Color) -> i32 { 'switch: { let __match_cond = ((*c.borrow()) as i32); match __match_cond { - v if v == (Color::kRed as i32) => { + __v if __v == (Color::kRed as i32) => { return 10; } - v if v == (Color::kGreen as i32) => { + __v if __v == (Color::kGreen as i32) => { return 20; } - v if v == (Color::kBlue as i32) => { + __v if __v == (Color::kBlue as i32) => { return 30; } _ => {} diff --git a/tests/unit/out/refcount/switch_fallthrough_chain.rs b/tests/unit/out/refcount/switch_fallthrough_chain.rs index f389991b..091e0daf 100644 --- a/tests/unit/out/refcount/switch_fallthrough_chain.rs +++ b/tests/unit/out/refcount/switch_fallthrough_chain.rs @@ -10,16 +10,16 @@ pub fn fallthrough_chain_0(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); let r: Value = Rc::new(RefCell::new(0)); switch!(match (*x.borrow()) { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) += 1; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) += 2; } - v if v == 3 => { + __v if __v == 3 => { (*r.borrow_mut()) += 4; } - v if v == 4 => { + __v if __v == 4 => { (*r.borrow_mut()) += 8; break; } diff --git a/tests/unit/out/refcount/switch_fallthrough_default.rs b/tests/unit/out/refcount/switch_fallthrough_default.rs index 3a42ef09..459bdf12 100644 --- a/tests/unit/out/refcount/switch_fallthrough_default.rs +++ b/tests/unit/out/refcount/switch_fallthrough_default.rs @@ -11,7 +11,7 @@ pub fn fallthrough_default_0(x: i32, flag: i32) -> i32 { let flag: Value = Rc::new(RefCell::new(flag)); let r: Value = Rc::new(RefCell::new(0)); switch!(match (*x.borrow()) { - v if v == 7 => { + __v if __v == 7 => { if ((*flag.borrow()) != 0) { (*r.borrow_mut()) = 100; break; diff --git a/tests/unit/out/refcount/switch_fallthrough_into_block.rs b/tests/unit/out/refcount/switch_fallthrough_into_block.rs index 5fca913a..71a53d6d 100644 --- a/tests/unit/out/refcount/switch_fallthrough_into_block.rs +++ b/tests/unit/out/refcount/switch_fallthrough_into_block.rs @@ -10,10 +10,10 @@ pub fn fallthrough_into_block_0(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); let r: Value = Rc::new(RefCell::new(0)); switch!(match (*x.borrow()) { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) += 1; } - v if v == 2 => { + __v if __v == 2 => { let tmp: Value = Rc::new(RefCell::new(((*r.borrow()) * 10))); (*r.borrow_mut()) = ((*tmp.borrow()) + 5); break; diff --git a/tests/unit/out/refcount/switch_fallthrough_one.rs b/tests/unit/out/refcount/switch_fallthrough_one.rs index 47f997ff..c328009b 100644 --- a/tests/unit/out/refcount/switch_fallthrough_one.rs +++ b/tests/unit/out/refcount/switch_fallthrough_one.rs @@ -10,10 +10,10 @@ pub fn fallthrough_one_0(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); let r: Value = Rc::new(RefCell::new(0)); switch!(match (*x.borrow()) { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) += 10; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) += 20; break; } diff --git a/tests/unit/out/refcount/switch_for_in_switch_break.rs b/tests/unit/out/refcount/switch_for_in_switch_break.rs index 444b1a17..c543eaba 100644 --- a/tests/unit/out/refcount/switch_for_in_switch_break.rs +++ b/tests/unit/out/refcount/switch_for_in_switch_break.rs @@ -12,7 +12,7 @@ pub fn for_in_switch_break_0(n: i32) -> i32 { 'switch: { let __match_cond = (*n.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let i: Value = Rc::new(RefCell::new(0)); 'loop_: while ((*i.borrow()) < 10) { if ((*i.borrow()) == 3) { diff --git a/tests/unit/out/refcount/switch_for_in_switch_continue.rs b/tests/unit/out/refcount/switch_for_in_switch_continue.rs index 6bf5f168..b98f3d36 100644 --- a/tests/unit/out/refcount/switch_for_in_switch_continue.rs +++ b/tests/unit/out/refcount/switch_for_in_switch_continue.rs @@ -12,7 +12,7 @@ pub fn for_in_switch_continue_0(n: i32) -> i32 { 'switch: { let __match_cond = (*n.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let i: Value = Rc::new(RefCell::new(0)); 'loop_: while ((*i.borrow()) < 5) { if (((*i.borrow()) % 2) == 0) { diff --git a/tests/unit/out/refcount/switch_for_switch_for_break.rs b/tests/unit/out/refcount/switch_for_switch_for_break.rs index 8063b20a..e7c070af 100644 --- a/tests/unit/out/refcount/switch_for_switch_for_break.rs +++ b/tests/unit/out/refcount/switch_for_switch_for_break.rs @@ -14,7 +14,7 @@ pub fn for_switch_for_break_0(n: i32) -> i32 { 'switch: { let __match_cond = (*i.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { let j: Value = Rc::new(RefCell::new(0)); 'loop_: while ((*j.borrow()) < 10) { if ((*j.borrow()) == 2) { diff --git a/tests/unit/out/refcount/switch_in_dowhile.rs b/tests/unit/out/refcount/switch_in_dowhile.rs index 03d69848..d7b72a1d 100644 --- a/tests/unit/out/refcount/switch_in_dowhile.rs +++ b/tests/unit/out/refcount/switch_in_dowhile.rs @@ -16,11 +16,11 @@ pub fn switch_in_dowhile_0(n: i32) -> i32 { 'switch: { let __match_cond = (*i.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { (*r.borrow_mut()) += 1; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) += 10; break 'switch; } diff --git a/tests/unit/out/refcount/switch_in_loop.rs b/tests/unit/out/refcount/switch_in_loop.rs index 4923a00b..15d10c25 100644 --- a/tests/unit/out/refcount/switch_in_loop.rs +++ b/tests/unit/out/refcount/switch_in_loop.rs @@ -14,11 +14,11 @@ pub fn switch_in_loop_0(n: i32) -> i32 { 'switch: { let __match_cond = ((*i.borrow()) % 3); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { (*r.borrow_mut()) += 1; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) += 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_mixed_literal_cases.rs b/tests/unit/out/refcount/switch_mixed_literal_cases.rs index 9423614e..b22b50e1 100644 --- a/tests/unit/out/refcount/switch_mixed_literal_cases.rs +++ b/tests/unit/out/refcount/switch_mixed_literal_cases.rs @@ -11,16 +11,16 @@ pub fn mixed_literal_cases_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == -1_i32 => { + __v if __v == -1_i32 => { return 1; } - v if v == 16 => { + __v if __v == 16 => { return 2; } - v if v == 65152 => { + __v if __v == 65152 => { return 3; } - v if v == -255_i32 => { + __v if __v == -255_i32 => { return 4; } _ => { diff --git a/tests/unit/out/refcount/switch_mixed_return_break.rs b/tests/unit/out/refcount/switch_mixed_return_break.rs index 670628f7..b4feeb4b 100644 --- a/tests/unit/out/refcount/switch_mixed_return_break.rs +++ b/tests/unit/out/refcount/switch_mixed_return_break.rs @@ -12,14 +12,14 @@ pub fn mixed_return_break_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 100; } - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 10; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { return 200; } _ => { diff --git a/tests/unit/out/refcount/switch_nested.rs b/tests/unit/out/refcount/switch_nested.rs index 3f98290d..807e4965 100644 --- a/tests/unit/out/refcount/switch_nested.rs +++ b/tests/unit/out/refcount/switch_nested.rs @@ -13,15 +13,15 @@ pub fn nested_0(a: i32, b: i32) -> i32 { 'switch: { let __match_cond = (*a.borrow()); match __match_cond { - v if v == 1 => { + __v if __v == 1 => { 'switch: { let __match_cond = (*b.borrow()); match __match_cond { - v if v == 10 => { + __v if __v == 10 => { (*r.borrow_mut()) = 11; break 'switch; } - v if v == 20 => { + __v if __v == 20 => { (*r.borrow_mut()) = 12; break 'switch; } @@ -34,7 +34,7 @@ pub fn nested_0(a: i32, b: i32) -> i32 { (*r.borrow_mut()) += 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_no_default.rs b/tests/unit/out/refcount/switch_no_default.rs index 1767661a..a9ab2aba 100644 --- a/tests/unit/out/refcount/switch_no_default.rs +++ b/tests/unit/out/refcount/switch_no_default.rs @@ -12,11 +12,11 @@ pub fn no_default_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 7 => { + __v if __v == 7 => { (*r.borrow_mut()) = 1; break 'switch; } - v if v == 8 => { + __v if __v == 8 => { (*r.borrow_mut()) = 2; break 'switch; } diff --git a/tests/unit/out/refcount/switch_on_assignment.rs b/tests/unit/out/refcount/switch_on_assignment.rs index 1e58948c..b67d6609 100644 --- a/tests/unit/out/refcount/switch_on_assignment.rs +++ b/tests/unit/out/refcount/switch_on_assignment.rs @@ -16,11 +16,11 @@ pub fn switch_on_assignment_0(x: i32) -> i32 { (*y.borrow()) }; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { (*r.borrow_mut()) = 10; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { (*r.borrow_mut()) = 20; break 'switch; } diff --git a/tests/unit/out/refcount/switch_on_call.rs b/tests/unit/out/refcount/switch_on_call.rs index 482168a9..912bac39 100644 --- a/tests/unit/out/refcount/switch_on_call.rs +++ b/tests/unit/out/refcount/switch_on_call.rs @@ -18,13 +18,13 @@ pub fn switch_on_call_1(x: i32) -> i32 { double_it_0(_v) }); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 100; } - v if v == 2 => { + __v if __v == 2 => { return 200; } - v if v == 4 => { + __v if __v == 4 => { return 400; } _ => { diff --git a/tests/unit/out/refcount/switch_stacked.rs b/tests/unit/out/refcount/switch_stacked.rs index 1e7e4232..4f6c512d 100644 --- a/tests/unit/out/refcount/switch_stacked.rs +++ b/tests/unit/out/refcount/switch_stacked.rs @@ -12,11 +12,11 @@ pub fn stacked_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { (*r.borrow_mut()) = 100; break 'switch; } - v if v == 4 || v == 5 => { + __v if __v == 4 || __v == 5 => { (*r.borrow_mut()) = 200; break 'switch; } diff --git a/tests/unit/out/refcount/switch_stacked_block.rs b/tests/unit/out/refcount/switch_stacked_block.rs index c580b58a..c9d94645 100644 --- a/tests/unit/out/refcount/switch_stacked_block.rs +++ b/tests/unit/out/refcount/switch_stacked_block.rs @@ -12,7 +12,7 @@ pub fn stacked_block_0(x: i32) -> i32 { 'switch: { let __match_cond = (*x.borrow()); match __match_cond { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { let y: Value = Rc::new(RefCell::new(((*x.borrow()) * 2))); (*r.borrow_mut()) = ((*y.borrow()) + 1); break 'switch; diff --git a/tests/unit/out/refcount/switch_stacked_with_inner_fallthrough.rs b/tests/unit/out/refcount/switch_stacked_with_inner_fallthrough.rs index 8241abc5..d96ef1a8 100644 --- a/tests/unit/out/refcount/switch_stacked_with_inner_fallthrough.rs +++ b/tests/unit/out/refcount/switch_stacked_with_inner_fallthrough.rs @@ -11,7 +11,7 @@ pub fn stacked_with_inner_fallthrough_0(x: i32, flag: i32) -> i32 { let flag: Value = Rc::new(RefCell::new(flag)); let r: Value = Rc::new(RefCell::new(0)); switch!(match (*x.borrow()) { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { if !((*flag.borrow()) != 0) { (*r.borrow_mut()) = 50; break; diff --git a/tests/unit/out/refcount/switch_while_in_switch_break.rs b/tests/unit/out/refcount/switch_while_in_switch_break.rs index 8cbb0698..09adb582 100644 --- a/tests/unit/out/refcount/switch_while_in_switch_break.rs +++ b/tests/unit/out/refcount/switch_while_in_switch_break.rs @@ -12,7 +12,7 @@ pub fn while_in_switch_break_0(n: i32) -> i32 { 'switch: { let __match_cond = (*n.borrow()); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let i: Value = Rc::new(RefCell::new(0)); 'loop_: while ((*i.borrow()) < 10) { if ((*i.borrow()) == 4) { diff --git a/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs b/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs index fab1c2a2..394d0439 100644 --- a/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs +++ b/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs @@ -40,7 +40,7 @@ pub fn dispatch_0(option: i32, __args: &[VaArg]) -> i32 { 'switch: { let __match_cond = (*option.borrow()); match __match_cond { - v if v == (opt::OPT_STRING_OUT as i32) => { + __v if __v == (opt::OPT_STRING_OUT as i32) => { let out: Value>> = Rc::new(RefCell::new( ((*ap.borrow_mut()).arg::>>()).clone(), )); @@ -48,21 +48,21 @@ pub fn dispatch_0(option: i32, __args: &[VaArg]) -> i32 { (*result.borrow_mut()) = 1; break 'switch; } - v if v == (opt::OPT_FILE as i32) => { + __v if __v == (opt::OPT_FILE as i32) => { let f: Value> = Rc::new(RefCell::new( ((*ap.borrow_mut()).arg::>()).clone(), )); (*result.borrow_mut()) = ((!((*f.borrow()).is_null())) as i32).clone(); break 'switch; } - v if v == (opt::OPT_NODE as i32) => { + __v if __v == (opt::OPT_NODE as i32) => { let n: Value> = Rc::new(RefCell::new( ((*ap.borrow_mut()).arg::>()).clone(), )); (*result.borrow_mut()) = (*(*(*n.borrow()).upgrade().deref()).data.borrow()); break 'switch; } - v if v == (opt::OPT_NODE_OUT as i32) => { + __v if __v == (opt::OPT_NODE_OUT as i32) => { let out: Value>> = Rc::new(RefCell::new( ((*ap.borrow_mut()).arg::>>()).clone(), )); diff --git a/tests/unit/out/unsafe/assign_as_value.rs b/tests/unit/out/unsafe/assign_as_value.rs index d7dd3a3e..688fd430 100644 --- a/tests/unit/out/unsafe/assign_as_value.rs +++ b/tests/unit/out/unsafe/assign_as_value.rs @@ -27,7 +27,7 @@ unsafe fn main_0() -> i32 { out }) as i32); match __match_cond { - v if v == ('x' as i32) => { + __v if __v == ('x' as i32) => { assert!((1 != 0)); break 'switch; } diff --git a/tests/unit/out/unsafe/enum_int_interop.rs b/tests/unit/out/unsafe/enum_int_interop.rs index fd3a5143..c89f0afd 100644 --- a/tests/unit/out/unsafe/enum_int_interop.rs +++ b/tests/unit/out/unsafe/enum_int_interop.rs @@ -98,16 +98,16 @@ pub unsafe fn classify_option_5(mut option: i32) -> i32 { 'switch: { let __match_cond = option; match __match_cond { - v if v == (Option::OPT_NONE as i32) => { + __v if __v == (Option::OPT_NONE as i32) => { return -1_i32; } - v if v == (Option::OPT_A as i32) => { + __v if __v == (Option::OPT_A as i32) => { return 1; } - v if v == (Option::OPT_B as i32) => { + __v if __v == (Option::OPT_B as i32) => { return 2; } - v if v == (Option::OPT_C as i32) => { + __v if __v == (Option::OPT_C as i32) => { return 3; } _ => { @@ -136,13 +136,13 @@ unsafe fn main_0() -> i32 { 'switch: { let __match_cond = (c as i32); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { break 'switch; } - v if v == 1 => { + __v if __v == 1 => { return 1; } - v if v == 2 => { + __v if __v == 2 => { return 2; } _ => { @@ -196,13 +196,13 @@ unsafe fn main_0() -> i32 { 'switch: { let __match_cond = (t as i32); match __match_cond { - v if v == (Tag::TAG_ZERO as i32) => { + __v if __v == (Tag::TAG_ZERO as i32) => { return 90; } - v if v == 1 => { + __v if __v == 1 => { return 91; } - v if v == 2 => { + __v if __v == 2 => { break 'switch; } _ => {} diff --git a/tests/unit/out/unsafe/enum_int_interop_c.rs b/tests/unit/out/unsafe/enum_int_interop_c.rs index 56d90545..f4e9feeb 100644 --- a/tests/unit/out/unsafe/enum_int_interop_c.rs +++ b/tests/unit/out/unsafe/enum_int_interop_c.rs @@ -98,16 +98,16 @@ pub unsafe fn classify_option_5(mut option: i32) -> i32 { 'switch: { let __match_cond = option; match __match_cond { - v if v == (Option::OPT_NONE as i32) => { + __v if __v == (Option::OPT_NONE as i32) => { return -1_i32; } - v if v == (Option::OPT_A as i32) => { + __v if __v == (Option::OPT_A as i32) => { return 1; } - v if v == (Option::OPT_B as i32) => { + __v if __v == (Option::OPT_B as i32) => { return 2; } - v if v == (Option::OPT_C as i32) => { + __v if __v == (Option::OPT_C as i32) => { return 3; } _ => { @@ -136,13 +136,13 @@ unsafe fn main_0() -> i32 { 'switch: { let __match_cond = (c as u32); match __match_cond { - v if v == (0 as u32) => { + __v if __v == (0 as u32) => { break 'switch; } - v if v == (1 as u32) => { + __v if __v == (1 as u32) => { return 1; } - v if v == (2 as u32) => { + __v if __v == (2 as u32) => { return 2; } _ => { @@ -196,13 +196,13 @@ unsafe fn main_0() -> i32 { 'switch: { let __match_cond = (t as u32); match __match_cond { - v if v == ((Tag_enum::TAG_ZERO as i32) as u32) => { + __v if __v == ((Tag_enum::TAG_ZERO as i32) as u32) => { return 90; } - v if v == (1 as u32) => { + __v if __v == (1 as u32) => { return 91; } - v if v == (2 as u32) => { + __v if __v == (2 as u32) => { break 'switch; } _ => {} diff --git a/tests/unit/out/unsafe/goto_cleanup.rs b/tests/unit/out/unsafe/goto_cleanup.rs index b4bcb361..6cba984d 100644 --- a/tests/unit/out/unsafe/goto_cleanup.rs +++ b/tests/unit/out/unsafe/goto_cleanup.rs @@ -53,7 +53,7 @@ pub unsafe fn from_switch_2(mut n: i32) -> i32 { 'switch: { let __match_cond = n; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { ret = 10; goto!('out); } diff --git a/tests/unit/out/unsafe/goto_switch_fallthrough.rs b/tests/unit/out/unsafe/goto_switch_fallthrough.rs index af0011cd..81961849 100644 --- a/tests/unit/out/unsafe/goto_switch_fallthrough.rs +++ b/tests/unit/out/unsafe/goto_switch_fallthrough.rs @@ -12,10 +12,10 @@ pub unsafe fn sm_0(mut n: i32) -> i32 { '__entry: { ret = 0; switch!(match n { - v if v == 0 => { + __v if __v == 0 => { ret += 1; } - v if v == 1 => { + __v if __v == 1 => { ret += 10; goto!('out); } diff --git a/tests/unit/out/unsafe/switch_basic.rs b/tests/unit/out/unsafe/switch_basic.rs index 6676e1b6..e35a27c9 100644 --- a/tests/unit/out/unsafe/switch_basic.rs +++ b/tests/unit/out/unsafe/switch_basic.rs @@ -8,18 +8,19 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub unsafe fn basic_0(mut x: i32) -> i32 { let mut r: i32 = 0; + let mut v: i32 = 0; 'switch: { let __match_cond = x; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { r = 10; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { r = 20; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 30; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_borrow_in_condition_and_in_body.rs b/tests/unit/out/unsafe/switch_borrow_in_condition_and_in_body.rs index e139a2bd..06fcf40a 100644 --- a/tests/unit/out/unsafe/switch_borrow_in_condition_and_in_body.rs +++ b/tests/unit/out/unsafe/switch_borrow_in_condition_and_in_body.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub unsafe fn borrow_in_condition_and_in_body_0(mut x: i32) -> i32 { switch!(match x { - v if v == 0 => {} + __v if __v == 0 => {} _ => { return ((x) + (1)); } diff --git a/tests/unit/out/unsafe/switch_case_then_default.rs b/tests/unit/out/unsafe/switch_case_then_default.rs index ee8d944c..fb7f2c08 100644 --- a/tests/unit/out/unsafe/switch_case_then_default.rs +++ b/tests/unit/out/unsafe/switch_case_then_default.rs @@ -11,7 +11,7 @@ pub unsafe fn case_then_default_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 2 => { + __v if __v == 2 => { r = 20; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_cases_and_default_stacked.rs b/tests/unit/out/unsafe/switch_cases_and_default_stacked.rs index 1541d1e4..b5213372 100644 --- a/tests/unit/out/unsafe/switch_cases_and_default_stacked.rs +++ b/tests/unit/out/unsafe/switch_cases_and_default_stacked.rs @@ -11,7 +11,7 @@ pub unsafe fn cases_and_default_stacked_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 3 => { + __v if __v == 3 => { r = 3; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_char.rs b/tests/unit/out/unsafe/switch_char.rs index d1962a73..7dbfb4e8 100644 --- a/tests/unit/out/unsafe/switch_char.rs +++ b/tests/unit/out/unsafe/switch_char.rs @@ -10,16 +10,16 @@ pub unsafe fn switch_char_0(mut c: u8) -> i32 { 'switch: { let __match_cond = (c as i32); match __match_cond { - v if v == (('a' as u8) as i32) => { + __v if __v == (('a' as u8) as i32) => { return 1; } - v if v == (('b' as u8) as i32) => { + __v if __v == (('b' as u8) as i32) => { return 2; } - v if v == (('\n' as u8) as i32) => { + __v if __v == (('\n' as u8) as i32) => { return 3; } - v if v == (('\0' as u8) as i32) => { + __v if __v == (('\0' as u8) as i32) => { return 4; } _ => { diff --git a/tests/unit/out/unsafe/switch_complex_cond.rs b/tests/unit/out/unsafe/switch_complex_cond.rs index 0fa751cd..ffec14d3 100644 --- a/tests/unit/out/unsafe/switch_complex_cond.rs +++ b/tests/unit/out/unsafe/switch_complex_cond.rs @@ -10,13 +10,13 @@ pub unsafe fn switch_complex_cond_0(mut p: *mut i32, mut bias: i32) -> i32 { 'switch: { let __match_cond = ((*p) + (bias)); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 1; } - v if v == 5 => { + __v if __v == 5 => { return 2; } - v if v == 10 => { + __v if __v == 10 => { return 3; } _ => { diff --git a/tests/unit/out/unsafe/switch_compound_case_body.rs b/tests/unit/out/unsafe/switch_compound_case_body.rs index a5739165..ce6a4d21 100644 --- a/tests/unit/out/unsafe/switch_compound_case_body.rs +++ b/tests/unit/out/unsafe/switch_compound_case_body.rs @@ -11,13 +11,13 @@ pub unsafe fn compound_case_body_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { let mut y: i32 = 10; let mut z: i32 = 20; r = ((y) + (z)); break 'switch; } - v if v == 2 => { + __v if __v == 2 => { let mut y: i32 = 100; r = ((y) - (1)); break 'switch; diff --git a/tests/unit/out/unsafe/switch_continue_inside_switch.rs b/tests/unit/out/unsafe/switch_continue_inside_switch.rs index 60e40df1..ab55021b 100644 --- a/tests/unit/out/unsafe/switch_continue_inside_switch.rs +++ b/tests/unit/out/unsafe/switch_continue_inside_switch.rs @@ -13,7 +13,7 @@ pub unsafe fn continue_inside_switch_0(mut n: i32) -> i32 { 'switch: { let __match_cond = i; match __match_cond { - v if v == 0 || v == 2 || v == 4 => { + __v if __v == 0 || __v == 2 || __v == 4 => { i.prefix_inc(); continue 'loop_; } diff --git a/tests/unit/out/unsafe/switch_default_first.rs b/tests/unit/out/unsafe/switch_default_first.rs index 1be0755f..fb32f4f7 100644 --- a/tests/unit/out/unsafe/switch_default_first.rs +++ b/tests/unit/out/unsafe/switch_default_first.rs @@ -11,11 +11,11 @@ pub unsafe fn default_first_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { r = 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_default_middle.rs b/tests/unit/out/unsafe/switch_default_middle.rs index ff44c598..ac17606e 100644 --- a/tests/unit/out/unsafe/switch_default_middle.rs +++ b/tests/unit/out/unsafe/switch_default_middle.rs @@ -11,11 +11,11 @@ pub unsafe fn default_middle_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { r = 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_default_then_case.rs b/tests/unit/out/unsafe/switch_default_then_case.rs index f75dfb60..e2d69e82 100644 --- a/tests/unit/out/unsafe/switch_default_then_case.rs +++ b/tests/unit/out/unsafe/switch_default_then_case.rs @@ -11,11 +11,11 @@ pub unsafe fn default_then_case_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { r = 1; break 'switch; } - v if v == 3 => { + __v if __v == 3 => { r = 3; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_empty_case_with_break.rs b/tests/unit/out/unsafe/switch_empty_case_with_break.rs index 97f92ba3..d9b35993 100644 --- a/tests/unit/out/unsafe/switch_empty_case_with_break.rs +++ b/tests/unit/out/unsafe/switch_empty_case_with_break.rs @@ -11,10 +11,10 @@ pub unsafe fn empty_case_with_break_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_enum.rs b/tests/unit/out/unsafe/switch_enum.rs index 583326da..1414aa4b 100644 --- a/tests/unit/out/unsafe/switch_enum.rs +++ b/tests/unit/out/unsafe/switch_enum.rs @@ -28,13 +28,13 @@ pub unsafe fn switch_enum_0(mut c: Color) -> i32 { 'switch: { let __match_cond = (c as i32); match __match_cond { - v if v == (Color::kRed as i32) => { + __v if __v == (Color::kRed as i32) => { return 10; } - v if v == (Color::kGreen as i32) => { + __v if __v == (Color::kGreen as i32) => { return 20; } - v if v == (Color::kBlue as i32) => { + __v if __v == (Color::kBlue as i32) => { return 30; } _ => {} diff --git a/tests/unit/out/unsafe/switch_fallthrough_chain.rs b/tests/unit/out/unsafe/switch_fallthrough_chain.rs index 1c787562..b0318e7f 100644 --- a/tests/unit/out/unsafe/switch_fallthrough_chain.rs +++ b/tests/unit/out/unsafe/switch_fallthrough_chain.rs @@ -9,16 +9,16 @@ use std::rc::Rc; pub unsafe fn fallthrough_chain_0(mut x: i32) -> i32 { let mut r: i32 = 0; switch!(match x { - v if v == 1 => { + __v if __v == 1 => { r += 1; } - v if v == 2 => { + __v if __v == 2 => { r += 2; } - v if v == 3 => { + __v if __v == 3 => { r += 4; } - v if v == 4 => { + __v if __v == 4 => { r += 8; break; } diff --git a/tests/unit/out/unsafe/switch_fallthrough_default.rs b/tests/unit/out/unsafe/switch_fallthrough_default.rs index d9d5dfd3..cab70056 100644 --- a/tests/unit/out/unsafe/switch_fallthrough_default.rs +++ b/tests/unit/out/unsafe/switch_fallthrough_default.rs @@ -9,7 +9,7 @@ use std::rc::Rc; pub unsafe fn fallthrough_default_0(mut x: i32, mut flag: i32) -> i32 { let mut r: i32 = 0; switch!(match x { - v if v == 7 => { + __v if __v == 7 => { if (flag != 0) { r = 100; break; diff --git a/tests/unit/out/unsafe/switch_fallthrough_into_block.rs b/tests/unit/out/unsafe/switch_fallthrough_into_block.rs index ba0dc430..fe4e0973 100644 --- a/tests/unit/out/unsafe/switch_fallthrough_into_block.rs +++ b/tests/unit/out/unsafe/switch_fallthrough_into_block.rs @@ -9,10 +9,10 @@ use std::rc::Rc; pub unsafe fn fallthrough_into_block_0(mut x: i32) -> i32 { let mut r: i32 = 0; switch!(match x { - v if v == 1 => { + __v if __v == 1 => { r += 1; } - v if v == 2 => { + __v if __v == 2 => { let mut tmp: i32 = ((r) * (10)); r = ((tmp) + (5)); break; diff --git a/tests/unit/out/unsafe/switch_fallthrough_one.rs b/tests/unit/out/unsafe/switch_fallthrough_one.rs index f894740b..6c6b5fd6 100644 --- a/tests/unit/out/unsafe/switch_fallthrough_one.rs +++ b/tests/unit/out/unsafe/switch_fallthrough_one.rs @@ -9,10 +9,10 @@ use std::rc::Rc; pub unsafe fn fallthrough_one_0(mut x: i32) -> i32 { let mut r: i32 = 0; switch!(match x { - v if v == 1 => { + __v if __v == 1 => { r += 10; } - v if v == 2 => { + __v if __v == 2 => { r += 20; break; } diff --git a/tests/unit/out/unsafe/switch_for_in_switch_break.rs b/tests/unit/out/unsafe/switch_for_in_switch_break.rs index 41ef40a0..78b117d4 100644 --- a/tests/unit/out/unsafe/switch_for_in_switch_break.rs +++ b/tests/unit/out/unsafe/switch_for_in_switch_break.rs @@ -11,7 +11,7 @@ pub unsafe fn for_in_switch_break_0(mut n: i32) -> i32 { 'switch: { let __match_cond = n; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let mut i: i32 = 0; 'loop_: while ((i) < (10)) { if ((i) == (3)) { diff --git a/tests/unit/out/unsafe/switch_for_in_switch_continue.rs b/tests/unit/out/unsafe/switch_for_in_switch_continue.rs index 15ce77dd..91e5dd4f 100644 --- a/tests/unit/out/unsafe/switch_for_in_switch_continue.rs +++ b/tests/unit/out/unsafe/switch_for_in_switch_continue.rs @@ -11,7 +11,7 @@ pub unsafe fn for_in_switch_continue_0(mut n: i32) -> i32 { 'switch: { let __match_cond = n; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let mut i: i32 = 0; 'loop_: while ((i) < (5)) { if (((i) % (2)) == (0)) { diff --git a/tests/unit/out/unsafe/switch_for_switch_for_break.rs b/tests/unit/out/unsafe/switch_for_switch_for_break.rs index 65c304b9..245401fe 100644 --- a/tests/unit/out/unsafe/switch_for_switch_for_break.rs +++ b/tests/unit/out/unsafe/switch_for_switch_for_break.rs @@ -13,7 +13,7 @@ pub unsafe fn for_switch_for_break_0(mut n: i32) -> i32 { 'switch: { let __match_cond = i; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { let mut j: i32 = 0; 'loop_: while ((j) < (10)) { if ((j) == (2)) { diff --git a/tests/unit/out/unsafe/switch_in_dowhile.rs b/tests/unit/out/unsafe/switch_in_dowhile.rs index 3c34a732..a9b42531 100644 --- a/tests/unit/out/unsafe/switch_in_dowhile.rs +++ b/tests/unit/out/unsafe/switch_in_dowhile.rs @@ -15,11 +15,11 @@ pub unsafe fn switch_in_dowhile_0(mut n: i32) -> i32 { 'switch: { let __match_cond = i; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { r += 1; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { r += 10; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_in_loop.rs b/tests/unit/out/unsafe/switch_in_loop.rs index 32499a54..d0746af1 100644 --- a/tests/unit/out/unsafe/switch_in_loop.rs +++ b/tests/unit/out/unsafe/switch_in_loop.rs @@ -13,11 +13,11 @@ pub unsafe fn switch_in_loop_0(mut n: i32) -> i32 { 'switch: { let __match_cond = ((i) % (3)); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { r += 1; break 'switch; } - v if v == 1 => { + __v if __v == 1 => { r += 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_mixed_literal_cases.rs b/tests/unit/out/unsafe/switch_mixed_literal_cases.rs index d9d62a93..c791ff07 100644 --- a/tests/unit/out/unsafe/switch_mixed_literal_cases.rs +++ b/tests/unit/out/unsafe/switch_mixed_literal_cases.rs @@ -10,16 +10,16 @@ pub unsafe fn mixed_literal_cases_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == -1_i32 => { + __v if __v == -1_i32 => { return 1; } - v if v == 16 => { + __v if __v == 16 => { return 2; } - v if v == 65152 => { + __v if __v == 65152 => { return 3; } - v if v == -255_i32 => { + __v if __v == -255_i32 => { return 4; } _ => { diff --git a/tests/unit/out/unsafe/switch_mixed_return_break.rs b/tests/unit/out/unsafe/switch_mixed_return_break.rs index c157adf7..5f59a747 100644 --- a/tests/unit/out/unsafe/switch_mixed_return_break.rs +++ b/tests/unit/out/unsafe/switch_mixed_return_break.rs @@ -11,14 +11,14 @@ pub unsafe fn mixed_return_break_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 100; } - v if v == 1 => { + __v if __v == 1 => { r = 10; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { return 200; } _ => { diff --git a/tests/unit/out/unsafe/switch_nested.rs b/tests/unit/out/unsafe/switch_nested.rs index 5630db70..5335743f 100644 --- a/tests/unit/out/unsafe/switch_nested.rs +++ b/tests/unit/out/unsafe/switch_nested.rs @@ -11,15 +11,15 @@ pub unsafe fn nested_0(mut a: i32, mut b: i32) -> i32 { 'switch: { let __match_cond = a; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { 'switch: { let __match_cond = b; match __match_cond { - v if v == 10 => { + __v if __v == 10 => { r = 11; break 'switch; } - v if v == 20 => { + __v if __v == 20 => { r = 12; break 'switch; } @@ -32,7 +32,7 @@ pub unsafe fn nested_0(mut a: i32, mut b: i32) -> i32 { r += 1; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_no_default.rs b/tests/unit/out/unsafe/switch_no_default.rs index 8c4c75c0..fa409611 100644 --- a/tests/unit/out/unsafe/switch_no_default.rs +++ b/tests/unit/out/unsafe/switch_no_default.rs @@ -11,11 +11,11 @@ pub unsafe fn no_default_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 7 => { + __v if __v == 7 => { r = 1; break 'switch; } - v if v == 8 => { + __v if __v == 8 => { r = 2; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_on_assignment.rs b/tests/unit/out/unsafe/switch_on_assignment.rs index d2044a6b..4011c7d4 100644 --- a/tests/unit/out/unsafe/switch_on_assignment.rs +++ b/tests/unit/out/unsafe/switch_on_assignment.rs @@ -15,11 +15,11 @@ pub unsafe fn switch_on_assignment_0(mut x: i32) -> i32 { y }; match __match_cond { - v if v == 1 => { + __v if __v == 1 => { r = 10; break 'switch; } - v if v == 2 => { + __v if __v == 2 => { r = 20; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_on_call.rs b/tests/unit/out/unsafe/switch_on_call.rs index 064c5390..c5f406ab 100644 --- a/tests/unit/out/unsafe/switch_on_call.rs +++ b/tests/unit/out/unsafe/switch_on_call.rs @@ -16,13 +16,13 @@ pub unsafe fn switch_on_call_1(mut x: i32) -> i32 { double_it_0(_v) }); match __match_cond { - v if v == 0 => { + __v if __v == 0 => { return 100; } - v if v == 2 => { + __v if __v == 2 => { return 200; } - v if v == 4 => { + __v if __v == 4 => { return 400; } _ => { diff --git a/tests/unit/out/unsafe/switch_stacked.rs b/tests/unit/out/unsafe/switch_stacked.rs index 6b42db06..133db86a 100644 --- a/tests/unit/out/unsafe/switch_stacked.rs +++ b/tests/unit/out/unsafe/switch_stacked.rs @@ -11,11 +11,11 @@ pub unsafe fn stacked_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { r = 100; break 'switch; } - v if v == 4 || v == 5 => { + __v if __v == 4 || __v == 5 => { r = 200; break 'switch; } diff --git a/tests/unit/out/unsafe/switch_stacked_block.rs b/tests/unit/out/unsafe/switch_stacked_block.rs index a7a3288f..f2358ad5 100644 --- a/tests/unit/out/unsafe/switch_stacked_block.rs +++ b/tests/unit/out/unsafe/switch_stacked_block.rs @@ -11,7 +11,7 @@ pub unsafe fn stacked_block_0(mut x: i32) -> i32 { 'switch: { let __match_cond = x; match __match_cond { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { let mut y: i32 = ((x) * (2)); r = ((y) + (1)); break 'switch; diff --git a/tests/unit/out/unsafe/switch_stacked_with_inner_fallthrough.rs b/tests/unit/out/unsafe/switch_stacked_with_inner_fallthrough.rs index 515da37b..3045d9a1 100644 --- a/tests/unit/out/unsafe/switch_stacked_with_inner_fallthrough.rs +++ b/tests/unit/out/unsafe/switch_stacked_with_inner_fallthrough.rs @@ -9,7 +9,7 @@ use std::rc::Rc; pub unsafe fn stacked_with_inner_fallthrough_0(mut x: i32, mut flag: i32) -> i32 { let mut r: i32 = 0; switch!(match x { - v if v == 1 || v == 2 || v == 3 => { + __v if __v == 1 || __v == 2 || __v == 3 => { if !(flag != 0) { r = 50; break; diff --git a/tests/unit/out/unsafe/switch_while_in_switch_break.rs b/tests/unit/out/unsafe/switch_while_in_switch_break.rs index 2acb971c..9a27d89a 100644 --- a/tests/unit/out/unsafe/switch_while_in_switch_break.rs +++ b/tests/unit/out/unsafe/switch_while_in_switch_break.rs @@ -11,7 +11,7 @@ pub unsafe fn while_in_switch_break_0(mut n: i32) -> i32 { 'switch: { let __match_cond = n; match __match_cond { - v if v == 0 => { + __v if __v == 0 => { let mut i: i32 = 0; 'loop_: while ((i) < (10)) { if ((i) == (4)) { diff --git a/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs b/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs index 79556876..25afdaa7 100644 --- a/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs +++ b/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs @@ -47,15 +47,15 @@ pub unsafe fn write_count_1(mut s: *mut Sink, mut count: i64) { 'switch: { let __match_cond = ((*s).width as u32); match __match_cond { - v if v == ((Width_enum::W_64 as i32) as u32) => { + __v if __v == ((Width_enum::W_64 as i32) as u32) => { (*((*s).out.handle as *mut i64)) = count; break 'switch; } - v if v == ((Width_enum::W_32 as i32) as u32) => { + __v if __v == ((Width_enum::W_32 as i32) as u32) => { (*((*s).out.handle as *mut i32)) = (count as i32); break 'switch; } - v if v == ((Width_enum::W_16 as i32) as u32) => { + __v if __v == ((Width_enum::W_16 as i32) as u32) => { (*((*s).out.handle as *mut i16)) = (count as i16); break 'switch; } diff --git a/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs b/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs index df278617..b9b89d6d 100644 --- a/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs +++ b/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs @@ -39,23 +39,23 @@ pub unsafe fn dispatch_0(mut option: i32, __args: &[VaArg]) -> i32 { 'switch: { let __match_cond = option; match __match_cond { - v if v == (opt::OPT_STRING_OUT as i32) => { + __v if __v == (opt::OPT_STRING_OUT as i32) => { let mut out: *mut *const u8 = ap.arg::<*mut *const u8>(); (*out) = (b"hello\0".as_ptr().cast_mut()).cast_const(); result = 1; break 'switch; } - v if v == (opt::OPT_FILE as i32) => { + __v if __v == (opt::OPT_FILE as i32) => { let mut f: *mut ::libc::FILE = ap.arg::<*mut ::libc::FILE>(); result = ((!((f).is_null())) as i32).clone(); break 'switch; } - v if v == (opt::OPT_NODE as i32) => { + __v if __v == (opt::OPT_NODE as i32) => { let mut n: *mut node = ap.arg::<*mut node>(); result = (*n).data; break 'switch; } - v if v == (opt::OPT_NODE_OUT as i32) => { + __v if __v == (opt::OPT_NODE_OUT as i32) => { let mut out: *mut *mut node = ap.arg::<*mut *mut node>(); (*out) = std::ptr::null_mut(); result = 2;