]> git.lizzy.rs Git - rust.git/blobdiff - src/test/mir-opt/end_region_destruction_extents_1.rs
Fix tests and assertions; add some comments
[rust.git] / src / test / mir-opt / end_region_destruction_extents_1.rs
index 15b104f6c2ff74b9206f5c38872395a3a0883b70..a5107d304386f6b56b0caeaa1edfd4f9ce588982 100644 (file)
@@ -41,16 +41,16 @@ fn drop(&mut self) {
 
 // Notes on the MIR output below:
 //
-// 1. The `EndRegion('10s)` is allowed to precede the `drop(_3)`
+// 1. The `EndRegion('13s)` is allowed to precede the `drop(_3)`
 //    solely because of the #[may_dangle] mentioned above.
 //
-// 2. Regarding the occurrence of `EndRegion('12ds)` *after* `StorageDead(_6)`
-//    (where we have borrows `&'12ds _6`): Eventually:
+// 2. Regarding the occurrence of `EndRegion('15ds)` *after* `StorageDead(_6)`
+//    (where we have borrows `&'15ds _6`): Eventually:
 //
 //    i. this code should be rejected (by mir-borrowck), or
 //
 //    ii. the MIR code generation should be changed so that the
-//        EndRegion('12ds)` precedes `StorageDead(_6)` in the
+//        EndRegion('15ds)` precedes `StorageDead(_6)` in the
 //        control-flow.  (Note: arielb1 views drop+storagedead as one
 //        unit, and does not see this option as a useful avenue to
 //        explore.), or
@@ -65,53 +65,46 @@ fn drop(&mut self) {
 
 // START rustc.main.QualifyAndPromoteConstants.before.mir
 // fn main() -> () {
-//     let mut _0: ();
-//     let mut _1: &'12ds S1;
-//     let mut _2: &'12ds S1;
-//     let mut _3: D1<'12ds, '10s>;
-//     let mut _4: &'12ds S1;
-//     let mut _5: &'12ds S1;
-//     let mut _6: S1;
-//     let mut _7: &'10s S1;
-//     let mut _8: &'10s S1;
-//     let mut _9: S1;
-//
+// let mut _0: ();
+//     let mut _1: &'15ds S1;
+//     let mut _2: D1<'15ds, '13s>;
+//     let mut _3: &'15ds S1;
+//     let mut _4: &'15ds S1;
+//     let _5: S1;
+//     let mut _6: &'13s S1;
+//     let mut _7: &'13s S1;
+//     let _8: S1;
 //     bb0: {
 //         StorageLive(_2);
 //         StorageLive(_3);
 //         StorageLive(_4);
 //         StorageLive(_5);
+//         _5 = S1::{{constructor}}(const "ex1",);
+//         _4 = &'15ds _5;
+//         _3 = &'15ds (*_4);
 //         StorageLive(_6);
-//         _6 = S1::{{constructor}}(const "ex1",);
-//         _5 = &'12ds _6;
-//         _4 = &'12ds (*_5);
 //         StorageLive(_7);
 //         StorageLive(_8);
-//         StorageLive(_9);
-//         _9 = S1::{{constructor}}(const "dang1",);
-//         _8 = &'10s _9;
-//         _7 = &'10s (*_8);
-//         _3 = D1<'12ds, '10s>::{{constructor}}(move _4, move _7);
-//         EndRegion('10s);
-//         StorageDead(_7);
-//         StorageDead(_4);
-//         _2 = (_3.0: &'12ds S1);
-//         _1 = move _2;
-//         StorageDead(_2);
-//         drop(_3) -> [return: bb2, unwind: bb1];
+//         _8 = S1::{{constructor}}(const "dang1",);
+//         _7 = &'13s _8;
+//         _6 = &'13s (*_7);
+//         _2 = D1<'15ds, '13s>::{{constructor}}(move _3, move _6);
+//         EndRegion('13s);
+//         StorageDead(_6);
+//         StorageDead(_3);
+//         _1 = (_2.0: &'15ds S1);
+//         drop(_2) -> [return: bb2, unwind: bb1];
 //     }
-//
 //     bb1: {
 //         resume;
 //     }
-//
 //     bb2: {
-//         StorageDead(_3);
+//         StorageDead(_2);
+//         StorageDead(_7);
 //         StorageDead(_8);
-//         StorageDead(_9);
+//         StorageDead(_4);
 //         StorageDead(_5);
-//         StorageDead(_6);
-//         EndRegion('12ds);
+//         EndRegion('15ds);
 //         _0 = ();
 //         return;
 //     }
@@ -119,52 +112,41 @@ fn drop(&mut self) {
 // END rustc.main.QualifyAndPromoteConstants.before.mir
 
 // START rustc.main.QualifyAndPromoteConstants.after.mir
-// fn main() -> () {
+// fn main() -> (){
 //     let mut _0: ();
-//     let mut _1: &'12ds S1;
-//     let mut _2: &'12ds S1;
-//     let mut _3: D1<'12ds, '10s>;
-//     let mut _4: &'12ds S1;
-//     let mut _5: &'12ds S1;
-//     let mut _6: S1;
-//     let mut _7: &'10s S1;
-//     let mut _8: &'10s S1;
-//     let mut _9: S1;
-//     let mut _10: &'10s S1;
-//     let mut _11: &'12ds S1;
-//
+//     let mut _1: &'15ds S1;
+//     let mut _2: D1<'15ds, '13s>;
+//     let mut _3: &'15ds S1;
+//     let mut _4: &'15ds S1;
+//     let _5: S1;
+//     let mut _6: &'13s S1;
+//     let mut _7: &'13s S1;
+//     let _8: S1;
 //     bb0: {
 //         StorageLive(_2);
 //         StorageLive(_3);
 //         StorageLive(_4);
-//         StorageLive(_5);
-//         _11 = promoted[1];
-//         _5 = &'12ds (*_11);
-//         _4 = &'12ds (*_5);
+//         _4 = &'15ds (promoted[1]: S1);
+//         _3 = &'15ds (*_4);
+//         StorageLive(_6);
 //         StorageLive(_7);
-//         StorageLive(_8);
-//         _10 = promoted[0];
-//         _8 = &'10s (*_10);
-//         _7 = &'10s (*_8);
-//         _3 = D1<'12ds, '10s>::{{constructor}}(move _4, move _7);
-//         EndRegion('10s);
-//         StorageDead(_7);
-//         StorageDead(_4);
-//         _2 = (_3.0: &'12ds S1);
-//         _1 = move _2;
-//         StorageDead(_2);
-//         drop(_3) -> [return: bb2, unwind: bb1];
+//         _7 = &'13s (promoted[0]: S1);
+//         _6 = &'13s (*_7);
+//         _2 = D1<'15ds, '13s>::{{constructor}}(move _3, move _6);
+//         EndRegion('13s);
+//         StorageDead(_6);
+//         StorageDead(_3);
+//         _1 = (_2.0: &'15ds S1);
+//         drop(_2) -> [return: bb2, unwind: bb1];
 //     }
-//
 //     bb1: {
 //         resume;
 //     }
-//
 //     bb2: {
-//         StorageDead(_3);
-//         StorageDead(_8);
-//         StorageDead(_5);
-//         EndRegion('12ds);
+//         StorageDead(_2);
+//         StorageDead(_7);
+//         StorageDead(_4);
+//         EndRegion('15ds);
 //         _0 = ();
 //         return;
 //     }