diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ccbb518e72d08..cffb67ef01328 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -63,6 +63,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { (if_then_scope, then_source_info), LintLevel::Inherited, |this| { + let source_info = if this.is_let(cond) { + let variable_scope = this.new_source_scope( + then_expr.span, + LintLevel::Inherited, + None, + ); + this.source_scope = variable_scope; + SourceInfo { span: then_expr.span, scope: variable_scope } + } else { + this.source_info(then_expr.span) + }; let (then_block, else_block) = this.in_if_then_scope(condition_scope, |this| { let then_blk = unpack!(this.then_else_break( @@ -70,8 +81,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span, + source_info )); + this.expr_into_dest(destination, then_blk, then_expr) }); then_block.and(else_block) @@ -97,7 +109,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) }); this.cfg.push_assign_constant( @@ -575,4 +587,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block_and } + + fn is_let(&self, expr: ExprId) -> bool { + match self.thir[expr].kind { + ExprKind::Let { .. } => true, + ExprKind::Scope { value, .. } => self.is_let(value), + _ => false, + } + } } diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 43a84f69699aa..9d5c262ed3025 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option, break_scope: region::Scope, - variable_scope_span: Span, + variable_source_info: SourceInfo, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, )); let rhs_then_block = unpack!(this.then_else_break( @@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, )); rhs_then_block.unit() @@ -74,13 +74,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_scope_span, + variable_source_info, ) }) } - ExprKind::Let { expr, ref pat } => { - this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span) - } + ExprKind::Let { expr, ref pat } => this.lower_let_expr( + block, + &this.thir[expr], + pat, + break_scope, + Some(variable_source_info.scope), + variable_source_info.span, + ), _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); let mutability = Mutability::Mut; @@ -1773,6 +1778,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, pat: &Pat<'tcx>, else_target: region::Scope, + source_scope: Option, span: Span, ) -> BlockAnd<()> { let expr_span = expr.span; @@ -1798,7 +1804,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap(); self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span)); - self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place); + self.declare_bindings( + source_scope, + pat.span.to(span), + pat, + ArmHasGuard(false), + opt_expr_place, + ); + let post_guard_block = self.bind_pattern( self.source_info(pat.span), guard_candidate, @@ -1970,12 +1983,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::If(e) => { let e = &this.thir[e]; guard_span = e.span; - this.then_else_break(block, e, None, match_scope, arm_span) + this.then_else_break( + block, + e, + None, + match_scope, + this.source_info(arm_span), + ) } Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; guard_span = s.span; - this.lower_let_expr(block, s, pat, match_scope, arm_span) + this.lower_let_expr(block, s, pat, match_scope, None, arm_span) } }); diff --git a/src/test/debuginfo/lexical-scope-in-if-let.rs b/src/test/debuginfo/lexical-scope-in-if-let.rs new file mode 100644 index 0000000000000..cdc37ce48fbad --- /dev/null +++ b/src/test/debuginfo/lexical-scope-in-if-let.rs @@ -0,0 +1,100 @@ +// compile-flags:-g + +// === GDB TESTS ================================================================================== + +// gdb-command:run +// gdb-command:info locals +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:z = 10 +// gdb-check:c = 789 +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// === LLDB TESTS ================================================================================= + +// lldb-command:run +// lldb-command:frame variable +// lldb-check:(int) a = 123 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10 + +// === CDB TESTS ================================================================================== + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]z = 0n10 +// cdb-check:[...]c = 0n789 +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +fn main() { + let a = id(123); + + zzz(); // #break + + if let Some(x) = id(Some(42)) { + zzz(); // #break + + let b = id(456); + + if let Ok(y) = id::>(Ok(true)) { + zzz(); // #break + + let c = id(789); + + if let (z, 42) = id((10, 42)) { + zzz(); // #break + } + } + } +} + +#[inline(never)] +fn id(value: T) -> T { value } + +fn zzz() { } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 445732f70220a..047853696f228 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 445732f70220a..047853696f228 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 1efaba044ecf1..982dd7a27bc6b 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,22 +7,24 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 + scope 1 { + } bb0: { - _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { - _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 + _0 = const 1_u32; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:5: 13:52 } diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index f22fbec03d000..15409fa0dd23c 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -27,9 +27,9 @@ let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:19:9: 19:13 scope 2 { debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:19:9: 19:13 - let _10: usize; // in scope 2 at $DIR/funky_arms.rs:24:17: 24:26 scope 3 { debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,52 +63,52 @@ } bb4: { - StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option {Formatter::precision}, val: Value(Scalar()) } } bb5: { - StorageDead(_8); // scope 2 at $DIR/funky_arms.rs:24:44: 24:45 - _9 = discriminant(_7); // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 - switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { - StorageLive(_10); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - _10 = ((_7 as Some).0: usize); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - _11 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - StorageLive(_12); // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - _12 = _2; // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - StorageLive(_13); // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - _13 = _6; // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - StorageLive(_14); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageLive(_15); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageLive(_16); // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _16 = _10; // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _15 = move _16 as u32 (Misc); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageDead(_16); // scope 2 at $DIR/funky_arms.rs:26:74: 26:75 - _14 = Add(move _15, const 1_u32); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageDead(_15); // scope 2 at $DIR/funky_arms.rs:26:78: 26:79 - StorageLive(_17); // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _17 = _3; // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 + StorageLive(_10); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + StorageLive(_11); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + _11 = &mut (*_1); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + StorageLive(_12); // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + _12 = _2; // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + _13 = _6; // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageLive(_16); // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _16 = _10; // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _15 = move _16 as u32 (Misc); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageDead(_16); // scope 3 at $DIR/funky_arms.rs:26:74: 26:75 + _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:26:78: 26:79 + StorageLive(_17); // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _17 = _3; // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 3 at $DIR/funky_arms.rs:26:9: 26:87 // mir::Constant // + span: $DIR/funky_arms.rs:26:9: 26:42 // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut Formatter<'s>, &'t0 T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::}, val: Value(Scalar()) } } bb7: { - StorageDead(_17); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_14); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_13); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_12); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_11); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_17); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_12); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_11); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:27:5: 27:6 goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 } diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 54930937c9103..ce7ca20358e12 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 - let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,15 +51,15 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 + StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 2 at $DIR/issue-41888.rs:10:29: 13:10 StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 299529ec649d8..b8023a6a8e690 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,11 +10,11 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 - } - scope 4 { + let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + scope 4 { + } } } scope 2 { @@ -32,19 +32,19 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { - StorageLive(_5); // scope 1 at $DIR/issue-75439.rs:10:14: 10:38 + StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:10:14: 10:38 StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _5 = transmute::(move _6) -> bb7; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 @@ -54,23 +54,23 @@ } bb5: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb6: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb7: { StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36 - Deinit(_0); // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - ((_0 as Some).0: [u8; 4]) = move _5; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - discriminant(_0) = 1; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - StorageDead(_5); // scope 1 at $DIR/issue-75439.rs:10:38: 10:39 + Deinit(_0); // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:10:38: 10:39 StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6 goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index a8cc61f052656..075fe8d090829 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,44 +8,44 @@ let mut _3: std::option::Option; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 - let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { - StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 -- StorageLive(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageLive(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _8 = _6; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _7 = Gt(move _8, const 42_u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageDead(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 -- StorageDead(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 + StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 +- StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 +- StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 08312bde20f51..70486f546d71b 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,36 +5,36 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 - let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 + let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:10:13: 10:19 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + } } bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { -- StorageLive(_3); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 +- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index e5867ccfc5cb6..d9f2681d145e6 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,56 +11,56 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 - let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { - StorageLive(_4); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - _4 = move ((_2 as Some).0: Empty); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 - StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 - _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -+ goto -> bb3; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 + StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 + StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 + _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 } bb3: { -- _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 +- _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar()) } } bb4: { -- _5 = const (); // scope 1 at $DIR/unreachable_diverging.rs:17:10: 17:10 -- goto -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:17:10: 17:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - - bb5: { - StorageDead(_6); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageDead(_5); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageLive(_7); // scope 1 at $DIR/unreachable_diverging.rs:18:9: 18:22 - unreachable; // scope 1 at $DIR/unreachable_diverging.rs:18:15: 18:19 + StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:18:9: 18:22 + unreachable; // scope 2 at $DIR/unreachable_diverging.rs:18:15: 18:19 } - bb6: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff index 0529b15522ea6..f8b41d7b4c5df 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index 0529b15522ea6..f8b41d7b4c5df 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir index 3c94fbddc4421..5657f9413a1b4 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 3c94fbddc4421..5657f9413a1b4 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: {