diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 6df06df5c60f4..83b1af84bdc1c 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -76,6 +76,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ) }) } + ExprKind::Use { source } => this.then_else_break( + block, + &this.thir[source], + temp_scope_override, + break_scope, + variable_source_info, + ), ExprKind::Let { expr, ref pat } => this.lower_let_expr( block, &this.thir[expr], diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff index 6c9df8f042b79..ed0ce764cf785 100644 --- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff +++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 } bb1: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 } bb2: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 } diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff index 9fb3982654abb..04bbf5989dcf7 100644 --- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff +++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 } bb1: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 } bb2: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 } diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff index 3a47da86735e3..d5502d1fe4090 100644 --- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff +++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 } bb1: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 } bb2: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 } diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff index 5319c987d418b..b400ddad448b0 100644 --- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff +++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 } bb1: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 } bb2: { + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 } diff --git a/tests/mir-opt/building/logical_and_in_conditional.function_from_issue_111583.built.after.mir b/tests/mir-opt/building/logical_and_in_conditional.function_from_issue_111583.built.after.mir new file mode 100644 index 0000000000000..51b6f45d2ba4e --- /dev/null +++ b/tests/mir-opt/building/logical_and_in_conditional.function_from_issue_111583.built.after.mir @@ -0,0 +1,113 @@ +// MIR for `function_from_issue_111583` after built + +fn function_from_issue_111583(_1: f64) -> () { + debug z => _1; // in scope 0 at $DIR/logical_and_in_conditional.rs:+0:31: +0:32 + let mut _0: (); // return place in scope 0 at $DIR/logical_and_in_conditional.rs:+0:39: +0:39 + let _2: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:9: +1:13 + let mut _3: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:16: +1:25 + let mut _5: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:8: +3:38 + let mut _6: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:8: +3:33 + let mut _7: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:8: +3:26 + let mut _8: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:9: +3:20 + let mut _9: f64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:9: +3:10 + let mut _10: u64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:29: +3:33 + let mut _11: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:42: +3:60 + let mut _12: f64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:42: +3:52 + let mut _13: f64; // in scope 0 at $DIR/logical_and_in_conditional.rs:+3:42: +3:43 + scope 1 { + debug mask => _2; // in scope 1 at $DIR/logical_and_in_conditional.rs:+1:9: +1:13 + let mut _4: i32; // in scope 1 at $DIR/logical_and_in_conditional.rs:+2:9: +2:16 + scope 2 { + debug ret => _4; // in scope 2 at $DIR/logical_and_in_conditional.rs:+2:9: +2:16 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:9: +1:13 + StorageLive(_3); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:16: +1:25 + _3 = Shl(const 1_u64, const 38_i32); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:16: +1:25 + _2 = Sub(move _3, const 1_u64); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:16: +1:29 + StorageDead(_3); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:29 + FakeRead(ForLet(None), _2); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:9: +1:13 + StorageLive(_4); // scope 1 at $DIR/logical_and_in_conditional.rs:+2:9: +2:16 + _4 = const 0_i32; // scope 1 at $DIR/logical_and_in_conditional.rs:+2:19: +2:20 + FakeRead(ForLet(None), _4); // scope 1 at $DIR/logical_and_in_conditional.rs:+2:9: +2:16 + StorageLive(_5); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:38 + StorageLive(_6); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:33 + StorageLive(_7); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:26 + StorageLive(_8); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:9: +3:20 + StorageLive(_9); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:9: +3:10 + _9 = _1; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:9: +3:10 + _8 = core::f64::::to_bits(move _9) -> [return: bb1, unwind: bb10]; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:9: +3:20 + // mir::Constant + // + span: $DIR/logical_and_in_conditional.rs:19:11: 19:18 + // + literal: Const { ty: fn(f64) -> u64 {core::f64::::to_bits}, val: Value() } + } + + bb1: { + StorageDead(_9); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:19: +3:20 + _7 = Shr(move _8, const 8_i32); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:26 + StorageDead(_8); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:25: +3:26 + StorageLive(_10); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:29: +3:33 + _10 = _2; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:29: +3:33 + _6 = BitAnd(move _7, move _10); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:33 + StorageDead(_10); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:32: +3:33 + StorageDead(_7); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:32: +3:33 + _5 = Eq(move _6, const 0_u64); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:38 + switchInt(move _5) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:38 + } + + bb2: { + StorageDead(_6); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:37: +3:38 + StorageLive(_11); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:60 + StorageLive(_12); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:52 + StorageLive(_13); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:43 + _13 = _1; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:43 + _12 = Rem(move _13, const 0.0625f64); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:52 + StorageDead(_13); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:51: +3:52 + _11 = Lt(move _12, const 1.0E-13f64); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:60 + switchInt(move _11) -> [0: bb5, otherwise: bb4]; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:60 + } + + bb3: { + goto -> bb7; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:8: +3:38 + } + + bb4: { + StorageDead(_12); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:59: +3:60 + _4 = Add(_4, const 1_i32); // scope 2 at $DIR/logical_and_in_conditional.rs:+4:9: +4:17 + _0 = const (); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:61: +5:6 + goto -> bb9; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:5: +5:6 + } + + bb5: { + goto -> bb6; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:42: +3:60 + } + + bb6: { + StorageDead(_12); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:59: +3:60 + goto -> bb8; // scope 2 at no-location + } + + bb7: { + StorageDead(_6); // scope 2 at $DIR/logical_and_in_conditional.rs:+3:37: +3:38 + goto -> bb8; // scope 2 at no-location + } + + bb8: { + _0 = const (); // scope 2 at $DIR/logical_and_in_conditional.rs:+5:6: +5:6 + goto -> bb9; // scope 2 at $DIR/logical_and_in_conditional.rs:+3:5: +5:6 + } + + bb9: { + StorageDead(_11); // scope 2 at $DIR/logical_and_in_conditional.rs:+5:5: +5:6 + StorageDead(_5); // scope 2 at $DIR/logical_and_in_conditional.rs:+5:5: +5:6 + StorageDead(_4); // scope 1 at $DIR/logical_and_in_conditional.rs:+6:1: +6:2 + StorageDead(_2); // scope 0 at $DIR/logical_and_in_conditional.rs:+6:1: +6:2 + return; // scope 0 at $DIR/logical_and_in_conditional.rs:+6:2: +6:2 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/logical_and_in_conditional.rs:+0:1: +6:2 + } +} diff --git a/tests/mir-opt/building/logical_and_in_conditional.rs b/tests/mir-opt/building/logical_and_in_conditional.rs new file mode 100644 index 0000000000000..c4fa8c1f18221 --- /dev/null +++ b/tests/mir-opt/building/logical_and_in_conditional.rs @@ -0,0 +1,33 @@ +struct Droppy(bool); + +impl Drop for Droppy { + fn drop(&mut self) { + println!("drop"); + } +} + +// EMIT_MIR logical_and_in_conditional.test_and.built.after.mir +fn test_and(a: i32, b: i32, c: i32) { + if Droppy(a == 0).0 && Droppy(b == 0).0 && Droppy(c == 0).0 {} +} + +// https://github.com/rust-lang/rust/issues/111583 +// EMIT_MIR logical_and_in_conditional.function_from_issue_111583.built.after.mir +fn function_from_issue_111583(z: f64) { + let mask = (1 << 38) - 1; + let mut ret = 0; + if (z.to_bits() >> 8) & mask == 0 && z % 0.0625 < 1e-13 { + ret += 1; + } +} + +fn main() { + function_from_issue_111583(0.0); + for a in 0..1 { + for b in 0..1 { + for c in 0..1 { + test_and(a, b, c); + } + } + } +} diff --git a/tests/mir-opt/building/logical_and_in_conditional.test_and.built.after.mir b/tests/mir-opt/building/logical_and_in_conditional.test_and.built.after.mir new file mode 100644 index 0000000000000..516ee71c040b3 --- /dev/null +++ b/tests/mir-opt/building/logical_and_in_conditional.test_and.built.after.mir @@ -0,0 +1,137 @@ +// MIR for `test_and` after built + +fn test_and(_1: i32, _2: i32, _3: i32) -> () { + debug a => _1; // in scope 0 at $DIR/logical_and_in_conditional.rs:+0:13: +0:14 + debug b => _2; // in scope 0 at $DIR/logical_and_in_conditional.rs:+0:21: +0:22 + debug c => _3; // in scope 0 at $DIR/logical_and_in_conditional.rs:+0:29: +0:30 + let mut _0: (); // return place in scope 0 at $DIR/logical_and_in_conditional.rs:+0:37: +0:37 + let mut _4: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:24 + let mut _5: Droppy; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:22 + let mut _6: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:21 + let mut _7: i32; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:16 + let mut _8: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:44 + let mut _9: Droppy; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:42 + let mut _10: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:41 + let mut _11: i32; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:36 + let mut _12: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:64 + let mut _13: Droppy; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:62 + let mut _14: bool; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:61 + let mut _15: i32; // in scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:56 + + bb0: { + StorageLive(_4); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:24 + StorageLive(_5); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:22 + StorageLive(_6); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:21 + StorageLive(_7); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:16 + _7 = _1; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:16 + _6 = Eq(move _7, const 0_i32); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:15: +1:21 + StorageDead(_7); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:20: +1:21 + _5 = Droppy(move _6); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:22 + StorageDead(_6); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:21: +1:22 + _4 = (_5.0: bool); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:24 + switchInt(move _4) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:24 + } + + bb1: { + drop(_5) -> [return: bb3, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:23: +1:24 + } + + bb2: { + goto -> bb14; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:8: +1:24 + } + + bb3: { + StorageDead(_5); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:23: +1:24 + StorageLive(_8); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:44 + StorageLive(_9); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:42 + StorageLive(_10); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:41 + StorageLive(_11); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:36 + _11 = _2; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:36 + _10 = Eq(move _11, const 0_i32); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:35: +1:41 + StorageDead(_11); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:40: +1:41 + _9 = Droppy(move _10); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:42 + StorageDead(_10); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:41: +1:42 + _8 = (_9.0: bool); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:44 + switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:44 + } + + bb4: { + drop(_9) -> [return: bb6, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:43: +1:44 + } + + bb5: { + goto -> bb12; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:28: +1:44 + } + + bb6: { + StorageDead(_9); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:43: +1:44 + StorageLive(_12); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:64 + StorageLive(_13); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:62 + StorageLive(_14); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:61 + StorageLive(_15); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:56 + _15 = _3; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:56 + _14 = Eq(move _15, const 0_i32); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:55: +1:61 + StorageDead(_15); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:60: +1:61 + _13 = Droppy(move _14); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:62 + StorageDead(_14); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:61: +1:62 + _12 = (_13.0: bool); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:64 + switchInt(move _12) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:64 + } + + bb7: { + drop(_13) -> [return: bb9, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:63: +1:64 + } + + bb8: { + goto -> bb10; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:48: +1:64 + } + + bb9: { + StorageDead(_13); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:63: +1:64 + _0 = const (); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:65: +1:67 + goto -> bb17; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:5: +1:67 + } + + bb10: { + drop(_13) -> [return: bb11, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:63: +1:64 + } + + bb11: { + StorageDead(_13); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:63: +1:64 + goto -> bb16; // scope 0 at no-location + } + + bb12: { + drop(_9) -> [return: bb13, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:43: +1:44 + } + + bb13: { + StorageDead(_9); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:43: +1:44 + goto -> bb16; // scope 0 at no-location + } + + bb14: { + drop(_5) -> [return: bb15, unwind: bb18]; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:23: +1:24 + } + + bb15: { + StorageDead(_5); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:23: +1:24 + goto -> bb16; // scope 0 at no-location + } + + bb16: { + _0 = const (); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:67: +1:67 + goto -> bb17; // scope 0 at $DIR/logical_and_in_conditional.rs:+1:5: +1:67 + } + + bb17: { + StorageDead(_12); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:66: +1:67 + StorageDead(_8); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:66: +1:67 + StorageDead(_4); // scope 0 at $DIR/logical_and_in_conditional.rs:+1:66: +1:67 + return; // scope 0 at $DIR/logical_and_in_conditional.rs:+2:2: +2:2 + } + + bb18 (cleanup): { + resume; // scope 0 at $DIR/logical_and_in_conditional.rs:+0:1: +2:2 + } +} diff --git a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff index 4dc98f8567402..4287b3ed66107 100644 --- a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff +++ b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff @@ -40,31 +40,33 @@ - } - - bb3: { -- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52 - switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52 - } - - bb4: { +- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52 - _4 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:55: +2:59 - goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76 - } - - bb5: { +- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52 - _4 = const false; // scope 0 at $DIR/const_goto_storage.rs:+2:69: +2:74 - goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76 - } - - bb6: { -- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76 - switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76 - } - - bb7: { +- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76 - _3 = const true; // scope 0 at $DIR/const_goto_storage.rs:+3:13: +3:17 - goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10 - } - - bb8: { +- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76 - _3 = const false; // scope 0 at $DIR/const_goto_storage.rs:+5:13: +5:18 - goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10 - } diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff index 32489b4bd6bfe..5bf88cff2a859 100644 --- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff @@ -39,19 +39,20 @@ StorageLive(_4); // scope 1 at $DIR/if.rs:+2:16: +2:17 - _4 = _1; // scope 1 at $DIR/if.rs:+2:16: +2:17 - _3 = Eq(move _4, const 1_i32); // scope 1 at $DIR/if.rs:+2:16: +2:22 +- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 + _4 = const 1_i32; // scope 1 at $DIR/if.rs:+2:16: +2:17 + _3 = const true; // scope 1 at $DIR/if.rs:+2:16: +2:22 - StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22 -- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 + switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 } bb1: { + StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22 _2 = const 2_i32; // scope 1 at $DIR/if.rs:+2:25: +2:26 goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39 } bb2: { + StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22 _2 = const 3_i32; // scope 1 at $DIR/if.rs:+2:36: +2:37 goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39 } @@ -70,20 +71,21 @@ StorageLive(_9); // scope 3 at $DIR/if.rs:+5:16: +5:17 - _9 = _1; // scope 3 at $DIR/if.rs:+5:16: +5:17 - _8 = Eq(move _9, const 1_i32); // scope 3 at $DIR/if.rs:+5:16: +5:22 +- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 + _9 = const 1_i32; // scope 3 at $DIR/if.rs:+5:16: +5:17 + _8 = const true; // scope 3 at $DIR/if.rs:+5:16: +5:22 - StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22 -- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 + switchInt(const true) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 } bb4: { + StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22 - _7 = _1; // scope 3 at $DIR/if.rs:+5:25: +5:26 + _7 = const 1_i32; // scope 3 at $DIR/if.rs:+5:25: +5:26 goto -> bb6; // scope 3 at $DIR/if.rs:+5:13: +5:43 } bb5: { + StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22 StorageLive(_10); // scope 3 at $DIR/if.rs:+5:36: +5:37 _10 = _1; // scope 3 at $DIR/if.rs:+5:36: +5:37 _7 = Add(move _10, const 1_i32); // scope 3 at $DIR/if.rs:+5:36: +5:41 diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff index 4ef4132008eaa..3a2be1b143247 100644 --- a/tests/mir-opt/equal_true.opt.InstSimplify.diff +++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/equal_true.rs:+1:8: +1:9 - _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 } bb1: { + StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:+1:20: +1:21 goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 } bb2: { + StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 _0 = const 1_i32; // scope 0 at $DIR/equal_true.rs:+1:31: +1:32 goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 } diff --git a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 754c6579af08f..8e3e32587b83d 100644 --- a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -12,16 +12,17 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18 } bb1: { + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18 _0 = const 0_i32; // scope 0 at $DIR/if_condition_int.rs:+1:21: +1:22 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:35 } bb2: { + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18 _0 = const 1_i32; // scope 0 at $DIR/if_condition_int.rs:+1:32: +1:33 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:35 } diff --git a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index 5964d76a4b96f..7259939f024eb 100644 --- a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -12,21 +12,19 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 -- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 + switchInt(move _3) -> [120: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:30: +1:31 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33 } diff --git a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 98918cc743ce0..ad43b49a86597 100644 --- a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -12,21 +12,19 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 + switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:18: +1:19 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:29: +1:30 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32 } diff --git a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index db38140b8d00b..f2c1a38b81e42 100644 --- a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -14,40 +14,36 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 + switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+2:9: +2:10 goto -> bb6; // scope 0 at $DIR/if_condition_int.rs:+1:5: +7:6 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 StorageLive(_4); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 StorageLive(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16 _5 = _1; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16 - _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 -- StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 - switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 + nop; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 + switchInt(move _5) -> [21: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 } bb3: { -+ StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 + StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+4:9: +4:10 goto -> bb5; // scope 0 at $DIR/if_condition_int.rs:+3:12: +7:6 } bb4: { -+ StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 + StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 _0 = const 2_u32; // scope 0 at $DIR/if_condition_int.rs:+6:9: +6:10 goto -> bb5; // scope 0 at $DIR/if_condition_int.rs:+3:12: +7:6 } diff --git a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index 1a1ac4caafaf0..7d47432e105a2 100644 --- a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -12,21 +12,19 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 -- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 + switchInt(move _3) -> [4294967254: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:30: +1:31 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33 } diff --git a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index fc3f50227dcb9..c1ead03510c5f 100644 --- a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -12,21 +12,19 @@ StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 -+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 + switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:18: +1:19 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:29: +1:30 goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32 } diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.diff index 4f22ad43700ac..e85490e67c01d 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.diff @@ -18,11 +18,11 @@ StorageLive(_3); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 - StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 } bb1: { + StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13 StorageLive(_4); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10 _4 = _1; // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10 _0 = move _4 as u32 (IntToInt); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:17 @@ -32,6 +32,7 @@ } bb2: { + StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13 StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 - _6 = panic(); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 + StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index f0c9ef419bd89..8bb6e327b9065 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.mir @@ -108,11 +108,11 @@ fn main() -> () { StorageDead(_13); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = Not(move _11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL switchInt(move _10) -> [0: bb4, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { + StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = core::panicking::AssertKind::Eq; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL FakeRead(ForLet(None), _15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -156,6 +156,7 @@ fn main() -> () { } bb7: { + StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _1 = const (); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL goto -> bb8; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } @@ -217,11 +218,11 @@ fn main() -> () { StorageDead(_34); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _31 = Not(move _32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL switchInt(move _31) -> [0: bb13, otherwise: bb12]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb12: { + StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _36 = core::panicking::AssertKind::Eq; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL FakeRead(ForLet(None), _36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -265,6 +266,7 @@ fn main() -> () { } bb16: { + StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _23 = const (); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL goto -> bb17; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff index 59de067f4a4f8..c6b299a6636e1 100644 --- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff +++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff @@ -32,12 +32,12 @@ bb1: { StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 } bb2: { + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 @@ -52,6 +52,8 @@ } bb4: { + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 _0 = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:11 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:+1:5: +5:6 } diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff index 17574b1b63568..8cca811c62698 100644 --- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff +++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff @@ -35,12 +35,12 @@ bb1: { StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 } bb2: { + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 @@ -55,6 +55,8 @@ } bb4: { + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16 _11 = const 0_usize; // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16 _12 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index 67918e62b9c22..bd4a90aa36ee0 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -31,12 +31,12 @@ bb1: { StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 - StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 - StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 } bb2: { + StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20 _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20 _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 @@ -51,6 +51,8 @@ } bb4: { + StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:+4:9: +4:11 goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:+1:5: +5:6 } diff --git a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff index 20e8ef2f72029..457cf54886547 100644 --- a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff @@ -40,39 +40,43 @@ - } - - bb3: { +- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 +- } +- +- bb4: { + StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 + _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 + _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50 + StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 ++ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 ++ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:51: +2:52 -- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -- } -- -- bb4: { - _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:55: +2:59 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - } - - bb5: { +- StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:51: +2:52 - _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - } - - bb6: { -+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 -+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 - StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76 - switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - } - - bb7: { ++ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 ++ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 ++ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 ++ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 + StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76 - _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+3:13: +3:17 - goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - } - - bb8: { +- StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76 - _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18 - goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - } @@ -82,8 +86,6 @@ - } - - bb10: { -+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 + _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18 + StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 + StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff index 8e7776a0bbcae..577daa7e01524 100644 --- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff +++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff @@ -13,16 +13,17 @@ _3 = _1; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 - _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 } bb1: { + StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:+1:21: +1:22 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 } bb2: { + StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 _0 = const 1_u32; // scope 0 at $DIR/not_equal_false.rs:+1:32: +1:33 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir index 715a1e3fcd479..f58455dabbd54 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir @@ -64,11 +64,11 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { _4 = Len((*_5)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL _3 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL } bb1: { + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL _8 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL @@ -90,6 +90,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb2: { + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL // mir::Constant // + span: no-location diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index 3b479710b4f2d..2d77de14448e0 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -142,11 +142,11 @@ fn array_casts() -> () { StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL switchInt(move _22) -> [0: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -170,6 +170,7 @@ fn array_casts() -> () { } bb4: { + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _12 = const (); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/tests/ui/rfc-2497-if-let-chains/chains-without-let.rs b/tests/ui/rfc-2497-if-let-chains/chains-without-let.rs index e0dded1521760..d2401c6f87e35 100644 --- a/tests/ui/rfc-2497-if-let-chains/chains-without-let.rs +++ b/tests/ui/rfc-2497-if-let-chains/chains-without-let.rs @@ -1,7 +1,7 @@ fn and_chain() { let z; if true && { z = 3; true} && z == 3 {} - //~^ ERROR E0381 + // no longer ERROR E0381 } fn and_chain_2() { diff --git a/tests/ui/rfc-2497-if-let-chains/chains-without-let.stderr b/tests/ui/rfc-2497-if-let-chains/chains-without-let.stderr index 30d5a6779fcd7..38caf9cb0097c 100644 --- a/tests/ui/rfc-2497-if-let-chains/chains-without-let.stderr +++ b/tests/ui/rfc-2497-if-let-chains/chains-without-let.stderr @@ -1,13 +1,3 @@ -error[E0381]: used binding `z` is possibly-uninitialized - --> $DIR/chains-without-let.rs:3:34 - | -LL | let z; - | - binding declared here but left uninitialized -LL | if true && { z = 3; true} && z == 3 {} - | ----- ^ `z` used here but it is possibly-uninitialized - | | - | binding initialized here in some conditions - error[E0381]: used binding `z` is possibly-uninitialized --> $DIR/chains-without-let.rs:9:31 | @@ -28,6 +18,6 @@ LL | if false || { z = 3; false} || z == 3 {} | | | binding initialized here in some conditions -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0381`.