Skip to content

Commit c3ca9a3

Browse files
committed
rustc_mir: create the let and "remainder" scopes in source order.
1 parent 9260305 commit c3ca9a3

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

src/librustc_mir/build/matches/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
505505
UserTypeProjections::none(),
506506
&mut |this, mutability, name, mode, var, span, ty, user_ty| {
507507
if visibility_scope.is_none() {
508-
visibility_scope =
509-
Some(this.new_source_scope(scope_span, LintLevel::Inherited, None));
510508
// If we have lints, create a new source scope
511509
// that marks the lints for the locals. See the comment
512510
// on the `source_info` field for why this is needed.
513511
if lint_level.is_explicit() {
514512
scope = this.new_source_scope(scope_span, lint_level, None);
515513
}
514+
visibility_scope = Some(this.new_source_scope(scope_span,
515+
LintLevel::Inherited,
516+
None));
516517
}
517518
let source_info = SourceInfo { span, scope };
518519
let visibility_scope = visibility_scope.unwrap();

src/test/mir-opt/box_expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ impl Drop for S {
2626
// let mut _3: ();
2727
// let mut _4: std::boxed::Box<S>;
2828
// scope 1 {
29+
// let _1: std::boxed::Box<S>;
2930
// }
3031
// scope 2 {
31-
// let _1: std::boxed::Box<S>;
3232
// }
3333
// bb0: {
3434
// StorageLive(_1);

src/test/mir-opt/issue-41110.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ impl S {
3434
// let mut _4: S;
3535
// let mut _5: bool;
3636
// scope 1 {
37+
// let _1: ();
3738
// }
3839
// scope 2 {
39-
// let _1: ();
4040
// }
4141
// ...
4242
// bb0: {
@@ -48,9 +48,9 @@ impl S {
4848
// let mut _5: S;
4949
// let mut _6: bool;
5050
// ...
51-
// let mut _2: S;
52-
// ...
5351
// let _1: S;
5452
// ...
53+
// let mut _2: S;
54+
// ...
5555
// bb0: {
5656
// END rustc.test.ElaborateDrops.after.mir

src/test/mir-opt/issue-49232.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ fn main() {
2323
// let mut _5: ();
2424
// let mut _6: &i32;
2525
// scope 1 {
26+
// let _2: i32;
2627
// }
2728
// scope 2 {
28-
// let _2: i32;
2929
// }
3030
// bb0: {
3131
// goto -> bb1;

src/test/mir-opt/nll/region-subtyping-basic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ fn main() {
2727
// | '_#4r | U0 | {bb2[4..=5], bb3[0..=1]}
2828
// END rustc.main.nll.0.mir
2929
// START rustc.main.nll.0.mir
30-
// let _6: &'_#4r usize;
31-
// ...
3230
// let _2: &'_#3r usize;
3331
// ...
32+
// let _6: &'_#4r usize;
33+
// ...
3434
// _2 = &'_#2r _1[_3];
3535
// ...
3636
// _6 = _2;

src/test/mir-opt/packed-struct-drop-aligned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ impl Drop for Droppy {
2424
// let mut _5: Droppy;
2525
// let mut _6: Aligned;
2626
// scope 1 {
27+
// let mut _1: Packed;
2728
// }
2829
// scope 2 {
29-
// let mut _1: Packed;
3030
// }
3131
//
3232
// bb0: {

0 commit comments

Comments
 (0)