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