diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-05-16 18:58:54 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-11-27 19:22:03 +0200 |
| commit | 563ed27c01c204d734355709c905f9a14246d4ff (patch) | |
| tree | 8609414c35f238977d85651ca531d6599eec7298 /src/test/mir-opt | |
| parent | 876a72a251e0d533f776fa9149b3e4daaeea3a61 (diff) | |
| download | rust-563ed27c01c204d734355709c905f9a14246d4ff.tar.gz rust-563ed27c01c204d734355709c905f9a14246d4ff.zip | |
rustc: move debug info from LocalDecl and UpvarDecl into a dedicated VarDebugInfo.
Diffstat (limited to 'src/test/mir-opt')
| -rw-r--r-- | src/test/mir-opt/box_expr.rs | 1 | ||||
| -rw-r--r-- | src/test/mir-opt/generator-storage-dead-unwind.rs | 2 | ||||
| -rw-r--r-- | src/test/mir-opt/inline-closure-borrows-arg.rs | 56 | ||||
| -rw-r--r-- | src/test/mir-opt/inline-closure-captures.rs | 60 | ||||
| -rw-r--r-- | src/test/mir-opt/inline-closure.rs | 52 | ||||
| -rw-r--r-- | src/test/mir-opt/issue-41110.rs | 5 | ||||
| -rw-r--r-- | src/test/mir-opt/issue-41888.rs | 4 | ||||
| -rw-r--r-- | src/test/mir-opt/issue-49232.rs | 1 | ||||
| -rw-r--r-- | src/test/mir-opt/match-arm-scopes.rs | 6 | ||||
| -rw-r--r-- | src/test/mir-opt/nll/region-subtyping-basic.rs | 4 | ||||
| -rw-r--r-- | src/test/mir-opt/packed-struct-drop-aligned.rs | 1 | ||||
| -rw-r--r-- | src/test/mir-opt/simplify_try.rs | 30 |
12 files changed, 185 insertions, 37 deletions
diff --git a/src/test/mir-opt/box_expr.rs b/src/test/mir-opt/box_expr.rs index 8dc6b73edf6..fa1a291858b 100644 --- a/src/test/mir-opt/box_expr.rs +++ b/src/test/mir-opt/box_expr.rs @@ -27,6 +27,7 @@ impl Drop for S { // let _3: (); // let mut _4: std::boxed::Box<S>; // scope 1 { +// debug x => _1; // } // bb0: { // StorageLive(_1); diff --git a/src/test/mir-opt/generator-storage-dead-unwind.rs b/src/test/mir-opt/generator-storage-dead-unwind.rs index 109304d6d22..ecce0a08c7b 100644 --- a/src/test/mir-opt/generator-storage-dead-unwind.rs +++ b/src/test/mir-opt/generator-storage-dead-unwind.rs @@ -37,8 +37,10 @@ fn main() { // ... // let mut _9: Bar; // scope 1 { +// debug a => _2; // let _3: Bar; // scope 2 { +// debug b => _3; // } // } // bb0: { diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs index 491130b7c5d..b5bfeef5e9c 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -17,23 +17,43 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 { // END RUST SOURCE // START rustc.foo.Inline.after.mir -// ... -// bb0: { -// ... -// _3 = [closure@HirId { owner: DefIndex(4), local_id: 31 }]; -// ... -// _4 = &_3; -// ... -// _6 = &(*_2); -// ... -// _7 = &(*_2); -// _5 = (move _6, move _7); -// _8 = move (_5.0: &i32); -// _9 = move (_5.1: &i32); -// ... -// _0 = (*_8); -// ... -// return; +// fn foo(_1: T, _2: &i32) -> i32{ +// debug _t => _1; +// debug q => _2; +// let mut _0: i32; +// let _3: [closure@HirId { owner: DefIndex(4), local_id: 31 }]; +// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 31 }]; +// let mut _5: (&i32, &i32); +// let mut _6: &i32; +// let mut _7: &i32; +// let mut _8: &i32; +// let mut _9: &i32; +// scope 1 { +// debug x => _3; +// scope 2 { +// debug r => _8; +// debug _s => _9; +// } +// } +// scope 3 { +// debug variable => _8; +// } +// bb0: { +// ... +// _3 = [closure@HirId { owner: DefIndex(4), local_id: 31 }]; +// ... +// _4 = &_3; +// ... +// _6 = &(*_2); +// ... +// _7 = &(*_2); +// _5 = (move _6, move _7); +// _8 = move (_5.0: &i32); +// _9 = move (_5.1: &i32); +// ... +// _0 = (*_8); +// ... +// return; +// } // } -// ... // END rustc.foo.Inline.after.mir diff --git a/src/test/mir-opt/inline-closure-captures.rs b/src/test/mir-opt/inline-closure-captures.rs new file mode 100644 index 00000000000..e73dbe48bd1 --- /dev/null +++ b/src/test/mir-opt/inline-closure-captures.rs @@ -0,0 +1,60 @@ +// compile-flags: -Z span_free_formats + +// Tests that MIR inliner can handle closure captures. + +fn main() { + println!("{:?}", foo(0, 14)); +} + +fn foo<T: Copy>(t: T, q: i32) -> (i32, T) { + let x = |_q| (q, t); + x(q) +} + +// END RUST SOURCE +// START rustc.foo.Inline.after.mir +// fn foo(_1: T, _2: i32) -> (i32, T){ +// debug t => _1; +// debug q => _2; +// let mut _0: (i32, T); +// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T]; +// let mut _4: &i32; +// let mut _5: &T; +// let mut _6: &[closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T]; +// let mut _7: (i32,); +// let mut _8: i32; +// let mut _11: i32; +// scope 1 { +// debug x => _3; +// scope 2 { +// debug _q => _11; +// debug q => (*((*_6).0: &i32)); +// debug t => (*((*_6).1: &T)); +// let mut _9: i32; +// let mut _10: T; +// } +// } +// bb0: { +// ... +// _4 = &_2; +// ... +// _5 = &_1; +// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }] { q: move _4, t: move _5 }; +// ... +// _6 = &_3; +// ... +// ... +// _8 = _2; +// _7 = (move _8,); +// _11 = move (_7.0: i32); +// ... +// _9 = (*((*_6).0: &i32)); +// ... +// _10 = (*((*_6).1: &T)); +// (_0.0: i32) = move _9; +// (_0.1: T) = move _10; +// ... +// return; +// } +// } +// END rustc.foo.Inline.after.mir diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 7c0259b643a..ddf027f4be3 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -13,22 +13,38 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 { // END RUST SOURCE // START rustc.foo.Inline.after.mir -// ... -// bb0: { -// ... -// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }]; -// ... -// _4 = &_3; -// ... -// _6 = _2; -// ... -// _7 = _2; -// _5 = (move _6, move _7); -// _8 = move (_5.0: i32); -// _9 = move (_5.1: i32); -// _0 = _8; -// ... -// return; -// } -// ... +// fn foo(_1: T, _2: i32) -> i32{ +// debug _t => _1; +// debug q => _2; +// let mut _0: i32; +// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 }]; +// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 15 }]; +// let mut _5: (i32, i32); +// let mut _6: i32; +// let mut _7: i32; +// let mut _8: i32; +// let mut _9: i32; +// scope 1 { +// debug x => _3; +// scope 2 { +// debug _t => _8; +// debug _q => _9; +// } +// } +// bb0: { +// ... +// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }]; +// ... +// _4 = &_3; +// ... +// _6 = _2; +// ... +// _7 = _2; +// _5 = (move _6, move _7); +// _8 = move (_5.0: i32); +// _9 = move (_5.1: i32); +// _0 = _8; +// ... +// return; +// } // END rustc.foo.Inline.after.mir diff --git a/src/test/mir-opt/issue-41110.rs b/src/test/mir-opt/issue-41110.rs index e73390f52b5..5ba54f98d00 100644 --- a/src/test/mir-opt/issue-41110.rs +++ b/src/test/mir-opt/issue-41110.rs @@ -35,6 +35,7 @@ impl S { // let mut _4: S; // let mut _5: bool; // scope 1 { +// debug x => _1; // } // ... // bb0: { @@ -47,7 +48,11 @@ impl S { // let mut _5: S; // let mut _6: bool; // ... +// debug u => _1; +// ... // let mut _2: S; // ... +// debug v => _2; +// ... // bb0: { // END rustc.test.ElaborateDrops.after.mir diff --git a/src/test/mir-opt/issue-41888.rs b/src/test/mir-opt/issue-41888.rs index 58f321d6df1..efe2b249d4a 100644 --- a/src/test/mir-opt/issue-41888.rs +++ b/src/test/mir-opt/issue-41888.rs @@ -25,9 +25,11 @@ enum E { // fn main() -> () { // let mut _0: (); // scope 1 { -// let _1: E; // `e` +// let _1: E; +// debug e => _1; // scope 2 { // let _6: K; +// debug _k => _6; // } // } // let mut _2: bool; diff --git a/src/test/mir-opt/issue-49232.rs b/src/test/mir-opt/issue-49232.rs index d0dbcbd7515..54c89b85f42 100644 --- a/src/test/mir-opt/issue-49232.rs +++ b/src/test/mir-opt/issue-49232.rs @@ -24,6 +24,7 @@ fn main() { // let _5: (); // let mut _6: &i32; // scope 1 { +// debug beacon => _2; // } // bb0: { // goto -> bb1; diff --git a/src/test/mir-opt/match-arm-scopes.rs b/src/test/mir-opt/match-arm-scopes.rs index c898d3a6f16..4412a16e74d 100644 --- a/src/test/mir-opt/match-arm-scopes.rs +++ b/src/test/mir-opt/match-arm-scopes.rs @@ -53,8 +53,14 @@ fn main() { // let _15: bool; // `b` // let _16: std::string::String; // `t` // scope 1 { +// debug a => _5; +// debug a => _6; +// debug s => _7; +// debug s => _8; // } // scope 2 { +// debug b => _15; +// debug t => _16; // } // bb0: { // FakeRead(ForMatchedPlace, _2); diff --git a/src/test/mir-opt/nll/region-subtyping-basic.rs b/src/test/mir-opt/nll/region-subtyping-basic.rs index 8228d9740f0..16e357fc162 100644 --- a/src/test/mir-opt/nll/region-subtyping-basic.rs +++ b/src/test/mir-opt/nll/region-subtyping-basic.rs @@ -29,8 +29,12 @@ fn main() { // START rustc.main.nll.0.mir // let _2: &'_#3r usize; // ... +// debug p => _2; +// ... // let _6: &'_#4r usize; // ... +// debug q => _6; +// ... // _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 da73cc96348..113f81c441f 100644 --- a/src/test/mir-opt/packed-struct-drop-aligned.rs +++ b/src/test/mir-opt/packed-struct-drop-aligned.rs @@ -25,6 +25,7 @@ impl Drop for Droppy { // let mut _5: Droppy; // let mut _6: Aligned; // scope 1 { +// debug x => _1; // } // // bb0: { diff --git a/src/test/mir-opt/simplify_try.rs b/src/test/mir-opt/simplify_try.rs index 7911fbd0a98..656b405ef34 100644 --- a/src/test/mir-opt/simplify_try.rs +++ b/src/test/mir-opt/simplify_try.rs @@ -10,6 +10,7 @@ fn main() { // END RUST SOURCE // START rustc.try_identity.SimplifyArmIdentity.before.mir // fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { +// debug x => _1; // let mut _0: std::result::Result<u32, i32>; // let _2: u32; // let mut _3: std::result::Result<u32, i32>; @@ -22,21 +23,27 @@ fn main() { // let _10: u32; // let mut _11: u32; // scope 1 { +// debug y => _10; // } // scope 2 { +// debug err => _6; // scope 3 { // scope 7 { +// debug t => _6; // } // scope 8 { +// debug v => _6; // let mut _12: i32; // } // } // } // scope 4 { +// debug val => _10; // scope 5 { // } // } // scope 6 { +// debug self => _1; // } // bb0: { // _5 = discriminant(_1); @@ -65,6 +72,7 @@ fn main() { // START rustc.try_identity.SimplifyArmIdentity.after.mir // fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { +// debug x => _1; // let mut _0: std::result::Result<u32, i32>; // let _2: u32; // let mut _3: std::result::Result<u32, i32>; @@ -77,21 +85,27 @@ fn main() { // let _10: u32; // let mut _11: u32; // scope 1 { +// debug y => _10; // } // scope 2 { +// debug err => _6; // scope 3 { // scope 7 { +// debug t => _6; // } // scope 8 { +// debug v => _6; // let mut _12: i32; // } // } // } // scope 4 { +// debug val => _10; // scope 5 { // } // } // scope 6 { +// debug self => _1; // } // bb0: { // _5 = discriminant(_1); @@ -120,6 +134,7 @@ fn main() { // START rustc.try_identity.SimplifyBranchSame.after.mir // fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { +// debug x => _1; // let mut _0: std::result::Result<u32, i32>; // let _2: u32; // let mut _3: std::result::Result<u32, i32>; @@ -132,21 +147,27 @@ fn main() { // let _10: u32; // let mut _11: u32; // scope 1 { +// debug y => _10; // } // scope 2 { +// debug err => _6; // scope 3 { // scope 7 { +// debug t => _6; // } // scope 8 { +// debug v => _6; // let mut _12: i32; // } // } // } // scope 4 { +// debug val => _10; // scope 5 { // } // } // scope 6 { +// debug self => _1; // } // bb0: { // _5 = discriminant(_1); @@ -166,23 +187,32 @@ fn main() { // START rustc.try_identity.SimplifyLocals.after.mir // fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> { +// debug x => _1; // let mut _0: std::result::Result<u32, i32>; // let mut _2: isize; +// let _3: i32; +// let _4: u32; // scope 1 { +// debug y => _4; // } // scope 2 { +// debug err => _3; // scope 3 { // scope 7 { +// debug t => _3; // } // scope 8 { +// debug v => _3; // } // } // } // scope 4 { +// debug val => _4; // scope 5 { // } // } // scope 6 { +// debug self => _1; // } // bb0: { // _2 = discriminant(_1); |
