]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inline/inline_generator.main.Inline.diff
Rollup merge of #103757 - ffmancera:ff/clarify_E0207, r=jackh726
[rust.git] / src / test / mir-opt / inline / inline_generator.main.Inline.diff
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:+0:11: +0:11
6       let _1: std::ops::GeneratorState<i32, bool>; // in scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
7       let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
8       let mut _3: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
9       let mut _4: [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
10 +     let mut _7: bool;                    // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
11       scope 1 {
12           debug _r => _1;                  // in scope 1 at $DIR/inline_generator.rs:+1:9: +1:11
13       }
14 +     scope 2 (inlined g) {                // at $DIR/inline_generator.rs:9:28: 9:31
15 +     }
16 +     scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new) { // at $DIR/inline_generator.rs:9:14: 9:32
17 +         debug pointer => _3;             // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
18 +         let mut _5: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
19 +         scope 4 {
20 +             scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
21 +                 debug pointer => _5;     // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
22 +                 let mut _6: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
23 +             }
24 +         }
25 +     }
26 +     scope 6 (inlined g::{closure#0}) {   // at $DIR/inline_generator.rs:9:14: 9:46
27 +         debug a => _11;                  // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
28 +         let mut _8: i32;                 // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
29 +         let mut _9: bool;                // in scope 6 at $DIR/inline_generator.rs:15:20: 15:21
30 +         let mut _10: bool;               // in scope 6 at $DIR/inline_generator.rs:15:9: 15:9
31 +         let _11: bool;                   // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
32 +         let mut _12: u32;                // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
33 +         let mut _13: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
34 +         let mut _14: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
35 +         let mut _15: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
36 +     }
37   
38       bb0: {
39           StorageLive(_1);                 // scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
40           StorageLive(_2);                 // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
41           StorageLive(_3);                 // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
42           StorageLive(_4);                 // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
43 -         _4 = g() -> bb1;                 // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
44 -                                          // mir::Constant
45 -                                          // + span: $DIR/inline_generator.rs:9:28: 9:29
46 -                                          // + literal: Const { ty: fn() -> impl Generator<bool> {g}, val: Value(<ZST>) }
47 -     }
48
49 -     bb1: {
50 +         Deinit(_4);                      // scope 2 at $DIR/inline_generator.rs:15:5: 15:41
51 +         discriminant(_4) = 0;            // scope 2 at $DIR/inline_generator.rs:15:5: 15:41
52           _3 = &mut _4;                    // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
53 -         _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
54 -                                          // mir::Constant
55 -                                          // + span: $DIR/inline_generator.rs:9:14: 9:22
56 -                                          // + user_ty: UserType(0)
57 -                                          // + literal: Const { ty: fn(&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) -> Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> {Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new}, val: Value(<ZST>) }
58 -     }
59
60 -     bb2: {
61 +         StorageLive(_5);                 // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
62 +         _5 = move _3;                    // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
63 +         StorageLive(_6);                 // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
64 +         _6 = move _5;                    // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
65 +         Deinit(_2);                      // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
66 +         (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) = move _6; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
67 +         StorageDead(_6);                 // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
68 +         StorageDead(_5);                 // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
69           StorageDead(_3);                 // scope 0 at $DIR/inline_generator.rs:+1:31: +1:32
70 -         _1 = <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
71 -                                          // mir::Constant
72 -                                          // + span: $DIR/inline_generator.rs:9:33: 9:39
73 -                                          // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) }
74 +         StorageLive(_7);                 // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
75 +         _7 = const false;                // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
76 +         StorageLive(_10);                // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
77 +         StorageLive(_11);                // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
78 +         _13 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
79 +         _12 = discriminant((*_13));      // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
80 +         switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
81       }
82   
83 -     bb3: {
84 +     bb1: {
85 +         StorageDead(_11);                // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
86 +         StorageDead(_10);                // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
87 +         StorageDead(_7);                 // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
88           StorageDead(_2);                 // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46
89           StorageDead(_4);                 // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47
90           _0 = const ();                   // scope 0 at $DIR/inline_generator.rs:+0:11: +2:2
91           StorageDead(_1);                 // scope 0 at $DIR/inline_generator.rs:+2:1: +2:2
92           return;                          // scope 0 at $DIR/inline_generator.rs:+2:2: +2:2
93       }
94   
95 -     bb4 (cleanup): {
96 +     bb2 (cleanup): {
97           resume;                          // scope 0 at $DIR/inline_generator.rs:+0:1: +2:2
98 +     }
99
100 +     bb3: {
101 +         _11 = move _7;                   // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
102 +         StorageLive(_8);                 // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
103 +         StorageLive(_9);                 // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
104 +         _9 = _11;                        // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
105 +         switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
106 +     }
107
108 +     bb4: {
109 +         _8 = const 7_i32;                // scope 6 at $DIR/inline_generator.rs:15:24: 15:25
110 +         goto -> bb6;                     // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
111 +     }
112
113 +     bb5: {
114 +         _8 = const 13_i32;               // scope 6 at $DIR/inline_generator.rs:15:35: 15:37
115 +         goto -> bb6;                     // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
116 +     }
117
118 +     bb6: {
119 +         StorageDead(_9);                 // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
120 +         Deinit(_1);                      // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
121 +         ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
122 +         discriminant(_1) = 0;            // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
123 +         _14 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
124 +         discriminant((*_14)) = 3;        // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
125 +         goto -> bb1;                     // scope 0 at $DIR/inline_generator.rs:15:11: 15:39
126 +     }
127
128 +     bb7: {
129 +         StorageLive(_8);                 // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
130 +         _10 = move _7;                   // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
131 +         StorageDead(_8);                 // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
132 +         Deinit(_1);                      // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
133 +         ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
134 +         discriminant(_1) = 1;            // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
135 +         _15 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
136 +         discriminant((*_15)) = 1;        // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
137 +         goto -> bb1;                     // scope 0 at $DIR/inline_generator.rs:15:41: 15:41
138 +     }
139
140 +     bb8: {
141 +         assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
142 +     }
143
144 +     bb9: {
145 +         unreachable;                     // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
146       }
147   }
148