]>
git.proxmox.com Git - rustc.git/blob - src/test/mir-opt/retag.rs
1 // ignore-wasm32-bare compiled with panic=abort by default
2 // ignore-tidy-linelength
3 // compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats
10 // Make sure we run the pass on a method, not just on bare functions.
11 fn foo
<'x
>(&self, x
: &'x
mut i32) -> &'x
mut i32 { x }
12 fn foo_shr
<'x
>(&self, x
: &'x
i32) -> &'x
i32 { x }
22 let v
= Test(0).foo(&mut x
); // just making sure we do not panic when there is a tuple struct ctor
23 let w
= { v }
; // assignment
24 let w
= w
; // reborrow
25 // escape-to-raw (mut)
30 let c
: fn(&i32) -> &i32 = |x
: &i32| -> &i32 { let _y = x; x }
;
33 // need to call `foo_shr` or it doesn't even get generated
36 // escape-to-raw (shr)
37 let _w
= _w
as *const _
;
41 // START rustc.{{impl}}-foo.EraseRegions.after.mir
43 // Retag([fn entry] _1);
44 // Retag([fn entry] _2);
51 // END rustc.{{impl}}-foo.EraseRegions.after.mir
52 // START rustc.{{impl}}-foo_shr.EraseRegions.after.mir
54 // Retag([fn entry] _1);
55 // Retag([fn entry] _2);
62 // END rustc.{{impl}}-foo_shr.EraseRegions.after.mir
63 // START rustc.main.EraseRegions.after.mir
68 // _3 = const Test::foo(move _4, move _6) -> [return: bb2, unwind: bb3];
87 // _12 = move _13 as *mut i32 (Misc);
90 // _16 = move _17(move _18) -> bb5;
96 // _20 = const Test::foo_shr(move _21, move _23) -> [return: bb6, unwind: bb7];
101 // END rustc.main.EraseRegions.after.mir
102 // START rustc.main-{{closure}}.EraseRegions.after.mir
103 // fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(22), local_id: 72 }], _2: &i32) -> &i32 {
106 // Retag([fn entry] _1);
107 // Retag([fn entry] _2);
117 // END rustc.main-{{closure}}.EraseRegions.after.mir
118 // START rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
119 // fn std::ptr::real_drop_in_place(_1: &mut Test) -> () {
124 // _3 = const <Test as std::ops::Drop>::drop(move _2) -> bb1;
131 // END rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir