about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-06-01 19:25:28 +0300
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-04-23 23:35:21 +0300
commitc3ca9a35be01934df917debca60bbc834f5c0653 (patch)
treeaac4240b81e0a26001a34397104151c9d9d5848c /src
parent9260305c9e6a15c7692b85324afbd7b36afb29ed (diff)
downloadrust-c3ca9a35be01934df917debca60bbc834f5c0653.tar.gz
rust-c3ca9a35be01934df917debca60bbc834f5c0653.zip
rustc_mir: create the `let` and "remainder" scopes in source order.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/build/matches/mod.rs5
-rw-r--r--src/test/mir-opt/box_expr.rs2
-rw-r--r--src/test/mir-opt/issue-41110.rs6
-rw-r--r--src/test/mir-opt/issue-49232.rs2
-rw-r--r--src/test/mir-opt/nll/region-subtyping-basic.rs4
-rw-r--r--src/test/mir-opt/packed-struct-drop-aligned.rs2
6 files changed, 11 insertions, 10 deletions
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index b5b2d78f1bd..5e15d98e246 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -505,14 +505,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
             UserTypeProjections::none(),
             &mut |this, mutability, name, mode, var, span, ty, user_ty| {
                 if visibility_scope.is_none() {
-                    visibility_scope =
-                        Some(this.new_source_scope(scope_span, LintLevel::Inherited, None));
                     // If we have lints, create a new source scope
                     // that marks the lints for the locals. See the comment
                     // on the `source_info` field for why this is needed.
                     if lint_level.is_explicit() {
                         scope = this.new_source_scope(scope_span, lint_level, None);
                     }
+                visibility_scope = Some(this.new_source_scope(scope_span,
+                                                           LintLevel::Inherited,
+                                                           None));
                 }
                 let source_info = SourceInfo { span, scope };
                 let visibility_scope = visibility_scope.unwrap();
diff --git a/src/test/mir-opt/box_expr.rs b/src/test/mir-opt/box_expr.rs
index 0201fed945a..d4852db6d47 100644
--- a/src/test/mir-opt/box_expr.rs
+++ b/src/test/mir-opt/box_expr.rs
@@ -26,9 +26,9 @@ impl Drop for S {
 //     let mut _3: ();
 //     let mut _4: std::boxed::Box<S>;
 //     scope 1 {
+//         let _1: std::boxed::Box<S>;
 //     }
 //     scope 2 {
-//         let _1: std::boxed::Box<S>;
 //     }
 //     bb0: {
 //         StorageLive(_1);
diff --git a/src/test/mir-opt/issue-41110.rs b/src/test/mir-opt/issue-41110.rs
index d4f545c9840..023440af0eb 100644
--- a/src/test/mir-opt/issue-41110.rs
+++ b/src/test/mir-opt/issue-41110.rs
@@ -34,9 +34,9 @@ impl S {
 //    let mut _4: S;
 //    let mut _5: bool;
 //    scope 1 {
+//        let _1: ();
 //    }
 //    scope 2 {
-//        let _1: ();
 //    }
 //    ...
 //    bb0: {
@@ -48,9 +48,9 @@ impl S {
 //    let mut _5: S;
 //    let mut _6: bool;
 //    ...
-//    let mut _2: S;
-//    ...
 //    let _1: S;
 //    ...
+//    let mut _2: S;
+//    ...
 //    bb0: {
 // END rustc.test.ElaborateDrops.after.mir
diff --git a/src/test/mir-opt/issue-49232.rs b/src/test/mir-opt/issue-49232.rs
index fb25e094bee..29446d2ecc2 100644
--- a/src/test/mir-opt/issue-49232.rs
+++ b/src/test/mir-opt/issue-49232.rs
@@ -23,9 +23,9 @@ fn main() {
 //     let mut _5: ();
 //     let mut _6: &i32;
 //     scope 1 {
+//         let _2: i32;
 //     }
 //     scope 2 {
-//         let _2: i32;
 //     }
 //     bb0: {
 //         goto -> bb1;
diff --git a/src/test/mir-opt/nll/region-subtyping-basic.rs b/src/test/mir-opt/nll/region-subtyping-basic.rs
index c2dda680b73..bb27461bb1e 100644
--- a/src/test/mir-opt/nll/region-subtyping-basic.rs
+++ b/src/test/mir-opt/nll/region-subtyping-basic.rs
@@ -27,10 +27,10 @@ fn main() {
 // | '_#4r    | U0 | {bb2[4..=5], bb3[0..=1]}
 // END rustc.main.nll.0.mir
 // START rustc.main.nll.0.mir
-// let _6: &'_#4r usize;
-// ...
 // let _2: &'_#3r usize;
 // ...
+// let _6: &'_#4r usize;
+// ...
 // _2 = &'_#2r _1[_3];
 // ...
 // _6 = _2;
diff --git a/src/test/mir-opt/packed-struct-drop-aligned.rs b/src/test/mir-opt/packed-struct-drop-aligned.rs
index f317c06de4b..7e8c58e64c2 100644
--- a/src/test/mir-opt/packed-struct-drop-aligned.rs
+++ b/src/test/mir-opt/packed-struct-drop-aligned.rs
@@ -24,9 +24,9 @@ impl Drop for Droppy {
 //     let mut _5: Droppy;
 //     let mut _6: Aligned;
 //     scope 1 {
+//         let mut _1: Packed;
 //     }
 //     scope 2 {
-//         let mut _1: Packed;
 //     }
 //
 //     bb0: {