1- // MIR for `bar` before Inline 2+ // MIR for `bar` after Inline 3 4 fn bar(_1: P) -> () { 5 debug _baz => _1; 6 let mut _0: (); 7 let _2: (); 8 let mut _3: &fn() {foo}; 9 let _4: fn() {foo}; 10 let mut _5: (); 11+ scope 1 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { 12+ } 13 14 bb0: { 15 StorageLive(_2); 16 StorageLive(_3); 17 StorageLive(_4); 18- _4 = hide_foo() -> [return: bb1, unwind: bb4]; 19+ _4 = hide_foo() -> [return: bb1, unwind: bb3]; 20 } 21 22 bb1: { 23 _3 = &_4; 24 StorageLive(_5); 25 _5 = (); 26- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; 27+ _2 = move (*_3)() -> [return: bb5, unwind: bb3]; 28 } 29 30 bb2: { 31- StorageDead(_5); 32- StorageDead(_3); 33- StorageDead(_4); 34- StorageDead(_2); 35- _0 = const (); 36- drop(_1) -> [return: bb3, unwind: bb5]; 37+ return; 38 } 39 40- bb3: { 41- return; 42+ bb3 (cleanup): { 43+ drop(_1) -> [return: bb4, unwind terminate]; 44 } 45 46 bb4 (cleanup): { 47- drop(_1) -> [return: bb5, unwind terminate]; 48+ resume; 49 } 50 51- bb5 (cleanup): { 52- resume; 53+ bb5: { 54+ StorageDead(_5); 55+ StorageDead(_3); 56+ StorageDead(_4); 57+ StorageDead(_2); 58+ _0 = const (); 59+ drop(_1) -> [return: bb2, unwind: bb4]; 60 } 61 } 62 63