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
9 // EMIT_MIR rustc.{{impl}}-foo.SimplifyCfg-elaborate-drops.after.mir
10 // EMIT_MIR rustc.{{impl}}-foo_shr.SimplifyCfg-elaborate-drops.after.mir
12 // Make sure we run the pass on a method, not just on bare functions.
13 fn foo<'x>(&self, x: &'x mut i32) -> &'x mut i32 {
16 fn foo_shr<'x>(&self, x: &'x i32) -> &'x i32 {
21 // EMIT_MIR rustc.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir
27 // EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
28 // EMIT_MIR rustc.main-{{closure}}.SimplifyCfg-elaborate-drops.after.mir
32 let v = Test(0).foo(&mut x); // just making sure we do not panic when there is a tuple struct ctor
33 let w = { v }; // assignment
34 let w = w; // reborrow
35 // escape-to-raw (mut)
40 let c: fn(&i32) -> &i32 = |x: &i32| -> &i32 {
46 // need to call `foo_shr` or it doesn't even get generated
49 // escape-to-raw (shr)
50 let _w = _w as *const _;