Skip to content

Commit 9776dbd

Browse files
committed
test Retag in drop shim
1 parent 15810af commit 9776dbd

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

src/test/mir-opt/retag.rs

+26-11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ impl Test {
1111
fn foo_shr<'x>(&self, x: &'x i32) -> &'x i32 { x }
1212
}
1313

14+
impl Drop for Test {
15+
fn drop(&mut self) {}
16+
}
17+
1418
fn main() {
1519
let mut x = 0;
1620
{
@@ -60,10 +64,12 @@ fn main() {
6064
// ...
6165
// bb0: {
6266
// ...
63-
// _3 = const Test::foo(move _4, move _6) -> bb1;
67+
// _3 = const Test::foo(move _4, move _6) -> [return: bb2, unwind: bb3];
6468
// }
6569
//
66-
// bb1: {
70+
// ...
71+
//
72+
// bb2: {
6773
// Retag(_3);
6874
// ...
6975
// _9 = move _3;
@@ -80,25 +86,20 @@ fn main() {
8086
// _12 = move _13 as *mut i32 (Misc);
8187
// Retag([raw] _12);
8288
// ...
83-
// _16 = move _17(move _18) -> bb2;
89+
// _16 = move _17(move _18) -> bb5;
8490
// }
8591
//
86-
// bb2: {
92+
// bb5: {
8793
// Retag(_16);
8894
// ...
89-
// _20 = const Test::foo_shr(move _21, move _23) -> bb3;
90-
// }
91-
//
92-
// bb3: {
93-
// ...
94-
// return;
95+
// _20 = const Test::foo_shr(move _21, move _23) -> [return: bb6, unwind: bb7];
9596
// }
9697
//
9798
// ...
9899
// }
99100
// END rustc.main.EraseRegions.after.mir
100101
// START rustc.main-{{closure}}.EraseRegions.after.mir
101-
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(20), local_id: 72 }], _2: &i32) -> &i32 {
102+
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(22), local_id: 72 }], _2: &i32) -> &i32 {
102103
// ...
103104
// bb0: {
104105
// Retag([fn entry] _1);
@@ -113,3 +114,17 @@ fn main() {
113114
// }
114115
// }
115116
// END rustc.main-{{closure}}.EraseRegions.after.mir
117+
// START rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
118+
// fn std::ptr::real_drop_in_place(_1: &mut Test) -> () {
119+
// ...
120+
// bb0: {
121+
// Retag([raw] _1);
122+
// _2 = &mut (*_1);
123+
// _3 = const <Test as std::ops::Drop>::drop(move _2) -> bb1;
124+
// }
125+
//
126+
// bb1: {
127+
// return;
128+
// }
129+
// }
130+
// END rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir

0 commit comments

Comments
 (0)