|  | 
|  | 1 | +- // MIR for `main` before Inline | 
|  | 2 | ++ // MIR for `main` after Inline | 
|  | 3 | +   | 
|  | 4 | +  fn main() -> () { | 
|  | 5 | +      let mut _0: ();                      // return place in scope 0 at $DIR/inline-generator.rs:7:11: 7:11 | 
|  | 6 | +      let _1: std::ops::GeneratorState<<impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Yield, <impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Return>; // in scope 0 at $DIR/inline-generator.rs:8:9: 8:11 | 
|  | 7 | +      let mut _2: std::pin::Pin<&mut impl std::ops::Generator<bool>>; // in scope 0 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 8 | +      let mut _3: &mut impl std::ops::Generator<bool>; // in scope 0 at $DIR/inline-generator.rs:8:23: 8:31 | 
|  | 9 | +      let mut _4: impl std::ops::Generator<bool>; // in scope 0 at $DIR/inline-generator.rs:8:28: 8:31 | 
|  | 10 | ++     let mut _7: bool;                    // in scope 0 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 11 | +      scope 1 { | 
|  | 12 | +          debug _r => _1;                  // in scope 1 at $DIR/inline-generator.rs:8:9: 8:11 | 
|  | 13 | +      } | 
|  | 14 | ++     scope 2 (inlined g) {                // at $DIR/inline-generator.rs:8:28: 8:31 | 
|  | 15 | ++     } | 
|  | 16 | ++     scope 3 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]>::new) { // at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 17 | ++         debug pointer => _3;             // in scope 3 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 18 | ++         let mut _5: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]; // in scope 3 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 19 | ++         scope 4 { | 
|  | 20 | ++             scope 5 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]>::new_unchecked) { // at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 21 | ++                 debug pointer => _5;     // in scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 22 | ++                 let mut _6: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]; // in scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 23 | ++             } | 
|  | 24 | ++         } | 
|  | 25 | ++     } | 
|  | 26 | ++     scope 6 (inlined g::{closure#0}) {   // at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 27 | ++         debug a => _8;                   // in scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 28 | ++         let mut _8: bool;                // in scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 29 | ++         let mut _9: u32;                 // in scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 30 | ++     } | 
|  | 31 | +   | 
|  | 32 | +      bb0: { | 
|  | 33 | +          StorageLive(_1);                 // scope 0 at $DIR/inline-generator.rs:8:9: 8:11 | 
|  | 34 | +          StorageLive(_2);                 // scope 0 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 35 | +          StorageLive(_3);                 // scope 0 at $DIR/inline-generator.rs:8:23: 8:31 | 
|  | 36 | +          StorageLive(_4);                 // scope 0 at $DIR/inline-generator.rs:8:28: 8:31 | 
|  | 37 | +-         _4 = g() -> bb1;                 // scope 0 at $DIR/inline-generator.rs:8:28: 8:31 | 
|  | 38 | +-                                          // mir::Constant | 
|  | 39 | +-                                          // + span: $DIR/inline-generator.rs:8:28: 8:29 | 
|  | 40 | +-                                          // + literal: Const { ty: fn() -> impl std::ops::Generator<bool> {g}, val: Value(Scalar(<ZST>)) } | 
|  | 41 | +-     } | 
|  | 42 | +-  | 
|  | 43 | +-     bb1: { | 
|  | 44 | ++         discriminant(_4) = 0;            // scope 2 at $DIR/inline-generator.rs:8:28: 8:31 | 
|  | 45 | +          _3 = &mut _4;                    // scope 0 at $DIR/inline-generator.rs:8:23: 8:31 | 
|  | 46 | +-         _2 = Pin::<&mut impl Generator<bool>>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 47 | +-                                          // mir::Constant | 
|  | 48 | +-                                          // + span: $DIR/inline-generator.rs:8:14: 8:22 | 
|  | 49 | +-                                          // + user_ty: UserType(0) | 
|  | 50 | +-                                          // + literal: Const { ty: fn(&mut impl std::ops::Generator<bool>) -> std::pin::Pin<&mut impl std::ops::Generator<bool>> {std::pin::Pin::<&mut impl std::ops::Generator<bool>>::new}, val: Value(Scalar(<ZST>)) } | 
|  | 51 | +-     } | 
|  | 52 | +-  | 
|  | 53 | +-     bb2: { | 
|  | 54 | ++         StorageLive(_5);                 // scope 4 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 55 | ++         _5 = move _3;                    // scope 4 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 56 | ++         StorageLive(_6);                 // scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 57 | ++         _6 = move _5;                    // scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 58 | ++         (_2.0: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]) = move _6; // scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 59 | ++         StorageDead(_6);                 // scope 5 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 60 | ++         StorageDead(_5);                 // scope 4 at $DIR/inline-generator.rs:8:14: 8:32 | 
|  | 61 | +          StorageDead(_3);                 // scope 0 at $DIR/inline-generator.rs:8:31: 8:32 | 
|  | 62 | +-         _1 = <impl Generator<bool> as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 63 | +-                                          // mir::Constant | 
|  | 64 | +-                                          // + span: $DIR/inline-generator.rs:8:33: 8:39 | 
|  | 65 | +-                                          // + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut impl std::ops::Generator<bool>>, bool) -> std::ops::GeneratorState<<impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Yield, <impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Return> {<impl std::ops::Generator<bool> as std::ops::Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) } | 
|  | 66 | ++         StorageLive(_7);                 // scope 0 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 67 | ++         _7 = const false;                // scope 0 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 68 | ++         _9 = discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]))); // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 69 | ++         switchInt(move _9) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 70 | +      } | 
|  | 71 | +   | 
|  | 72 | +-     bb3: { | 
|  | 73 | ++     bb1: { | 
|  | 74 | ++         StorageDead(_7);                 // scope 0 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 75 | +          StorageDead(_2);                 // scope 0 at $DIR/inline-generator.rs:8:45: 8:46 | 
|  | 76 | +          StorageDead(_4);                 // scope 0 at $DIR/inline-generator.rs:8:46: 8:47 | 
|  | 77 | +          _0 = const ();                   // scope 0 at $DIR/inline-generator.rs:7:11: 9:2 | 
|  | 78 | +          StorageDead(_1);                 // scope 0 at $DIR/inline-generator.rs:9:1: 9:2 | 
|  | 79 | +          return;                          // scope 0 at $DIR/inline-generator.rs:9:2: 9:2 | 
|  | 80 | +      } | 
|  | 81 | +   | 
|  | 82 | +-     bb4 (cleanup): { | 
|  | 83 | ++     bb2 (cleanup): { | 
|  | 84 | +          resume;                          // scope 0 at $DIR/inline-generator.rs:7:1: 9:2 | 
|  | 85 | ++     } | 
|  | 86 | ++  | 
|  | 87 | ++     bb3: { | 
|  | 88 | ++         _8 = move _7;                    // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 89 | ++         switchInt(_8) -> [false: bb4, otherwise: bb5]; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 90 | ++     } | 
|  | 91 | ++  | 
|  | 92 | ++     bb4: { | 
|  | 93 | ++         ((_1 as Yielded).0: i32) = const 13_i32; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 94 | ++         goto -> bb6;                     // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 95 | ++     } | 
|  | 96 | ++  | 
|  | 97 | ++     bb5: { | 
|  | 98 | ++         ((_1 as Yielded).0: i32) = const 7_i32; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 99 | ++         goto -> bb6;                     // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 100 | ++     } | 
|  | 101 | ++  | 
|  | 102 | ++     bb6: { | 
|  | 103 | ++         discriminant(_1) = 0;            // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 104 | ++         discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]))) = 3; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 105 | ++         goto -> bb1;                     // scope 0 at $DIR/inline-generator.rs:14:11: 14:39 | 
|  | 106 | ++     } | 
|  | 107 | ++  | 
|  | 108 | ++     bb7: { | 
|  | 109 | ++         ((_1 as Complete).0: bool) = move _7; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 110 | ++         discriminant(_1) = 1;            // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 111 | ++         discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:14:5: 14:41 {bool, i32}]))) = 1; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 112 | ++         goto -> bb1;                     // scope 0 at $DIR/inline-generator.rs:14:41: 14:41 | 
|  | 113 | ++     } | 
|  | 114 | ++  | 
|  | 115 | ++     bb8: { | 
|  | 116 | ++         assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 117 | ++     } | 
|  | 118 | ++  | 
|  | 119 | ++     bb9: { | 
|  | 120 | ++         unreachable;                     // scope 6 at $DIR/inline-generator.rs:8:14: 8:46 | 
|  | 121 | +      } | 
|  | 122 | +  } | 
|  | 123 | +   | 
0 commit comments