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