summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
blob: e05c605a4e47f7f590672a4c38211345df78428d (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
- // MIR for `main` before Inline
+ // MIR for `main` after Inline
  
  fn main() -> () {
      let mut _0: ();
      let _1: std::ops::GeneratorState<i32, bool>;
      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 _5: bool;
      scope 1 {
          debug _r => _1;
      }
+     scope 2 (inlined g) {
+     }
+     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 => _5;
+         let mut _6: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+         let mut _7: u32;
+         let mut _8: i32;
+         let mut _9: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+         let mut _10: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+     }
  
      bb0: {
          StorageLive(_1);
          StorageLive(_2);
          StorageLive(_3);
          StorageLive(_4);
-         _4 = g() -> [return: bb1, unwind unreachable];
-     }
- 
-     bb1: {
+         _4 = [generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)];
          _3 = &mut _4;
-         _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new(move _3) -> [return: bb2, unwind unreachable];
-     }
- 
-     bb2: {
+         _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]> { pointer: move _3 };
          StorageDead(_3);
-         _1 = <[generator@$DIR/inline_generator.rs:16:5: 16:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
+         StorageLive(_5);
+         _5 = const false;
+         _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
+         _7 = discriminant((*_6));
+         switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8];
      }
  
-     bb3: {
+     bb1: {
+         StorageDead(_5);
          StorageDead(_2);
          StorageDead(_4);
          _0 = const ();
          StorageDead(_1);
          return;
+     }
+ 
+     bb2: {
+         StorageLive(_8);
+         switchInt(_5) -> [0: bb3, otherwise: bb4];
+     }
+ 
+     bb3: {
+         _8 = const 13_i32;
+         goto -> bb5;
+     }
+ 
+     bb4: {
+         _8 = const 7_i32;
+         goto -> bb5;
+     }
+ 
+     bb5: {
+         _1 = GeneratorState::<i32, bool>::Yielded(move _8);
+         _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
+         discriminant((*_9)) = 3;
+         goto -> bb1;
+     }
+ 
+     bb6: {
+         assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable];
+     }
+ 
+     bb7: {
+         StorageLive(_8);
+         StorageDead(_8);
+         _1 = GeneratorState::<i32, bool>::Complete(_5);
+         _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
+         discriminant((*_10)) = 1;
+         goto -> bb1;
+     }
+ 
+     bb8: {
+         unreachable;
      }
  }