- // MIR for `main` before Inline + // MIR for `main` after Inline fn main() -> () { let mut _0: (); let _1: std::ops::GeneratorState; let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>; let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8}; + let mut _6: bool; scope 1 { debug _r => _1; } + scope 2 (inlined g) { + let mut _5: {generator@$DIR/inline_generator.rs:16:5: 16:8}; + } + scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) { + debug pointer => _3; + scope 4 { + scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) { + debug pointer => _3; + } + } + } + scope 6 (inlined g::{closure#0}) { + debug a => _6; + let mut _7: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; + let mut _8: u32; + let mut _9: i32; + } bb0: { StorageLive(_1); StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = g() -> [return: bb1, unwind unreachable]; + StorageLive(_5); + _5 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)}; + _4 = move (_5 as subtype {generator@$DIR/inline_generator.rs:16:5: 16:8}); + StorageDead(_5); + _3 = &mut _4; + _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 }; + StorageDead(_3); + StorageLive(_6); + _6 = const false; + _7 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); + _8 = discriminant((*_7)); + switchInt(move _8) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; } bb1: { - _3 = &mut _4; - _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable]; + StorageDead(_6); + StorageDead(_2); + drop(_4) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_3); - _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; + StorageDead(_4); + _0 = const (); + StorageDead(_1); + return; } bb3: { - StorageDead(_2); - drop(_4) -> [return: bb4, unwind unreachable]; + StorageLive(_9); + switchInt(_6) -> [0: bb4, otherwise: bb5]; } bb4: { - StorageDead(_4); - _0 = const (); - StorageDead(_1); - return; + _9 = const 13_i32; + goto -> bb6; + } + + bb5: { + _9 = const 7_i32; + goto -> bb6; + } + + bb6: { + _1 = GeneratorState::::Yielded(move _9); + discriminant((*_7)) = 3; + goto -> bb1; + } + + bb7: { + assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable]; + } + + bb8: { + StorageLive(_9); + StorageDead(_9); + _1 = GeneratorState::::Complete(_6); + discriminant((*_7)) = 1; + goto -> bb1; + } + + bb9: { + unreachable; } }