fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
9.8 KiB343 linesraw
1// MIR for `b::{closure#0}` 0 generator_resume
2/* generator_layout = GeneratorLayout {
3    field_tys: {
4        _0: GeneratorSavedTy {
5            ty: Generator(
6                DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
7                [
8                std::future::ResumeTy,
9                (),
10                (),
11                GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
12                (),
13                ],
14                Static,
15            ),
16            source_info: SourceInfo {
17                span: $DIR/async_await.rs:15:9: 15:14 (#8),
18                scope: scope[0],
19            },
20            ignore_for_traits: false,
21        },
22        _1: GeneratorSavedTy {
23            ty: Generator(
24                DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
25                [
26                std::future::ResumeTy,
27                (),
28                (),
29                GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
30                (),
31                ],
32                Static,
33            ),
34            source_info: SourceInfo {
35                span: $DIR/async_await.rs:16:9: 16:14 (#10),
36                scope: scope[0],
37            },
38            ignore_for_traits: false,
39        },
40    },
41    variant_fields: {
42        Unresumed(0): [],
43        Returned (1): [],
44        Panicked (2): [],
45        Suspend0 (3): [_0],
46        Suspend1 (4): [_1],
47    },
48    storage_conflicts: BitMatrix(2x2) {
49        (_0, _0),
50        (_1, _1),
51    },
52} */
53
54fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> {
55    debug _task_context => _38;
56    let mut _0: std::task::Poll<()>;
57    let _3: ();
58    let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16};
59    let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16};
60    let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16};
61    let mut _7: ();
62    let _8: ();
63    let mut _9: std::task::Poll<()>;
64    let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
65    let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
66    let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
67    let mut _13: &mut std::task::Context<'_>;
68    let mut _14: &mut std::task::Context<'_>;
69    let mut _15: &mut std::task::Context<'_>;
70    let mut _16: isize;
71    let mut _18: !;
72    let mut _19: &mut std::task::Context<'_>;
73    let mut _20: ();
74    let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16};
75    let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16};
76    let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16};
77    let _24: ();
78    let mut _25: std::task::Poll<()>;
79    let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
80    let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
81    let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
82    let mut _29: &mut std::task::Context<'_>;
83    let mut _30: &mut std::task::Context<'_>;
84    let mut _31: &mut std::task::Context<'_>;
85    let mut _32: isize;
86    let mut _34: !;
87    let mut _35: &mut std::task::Context<'_>;
88    let mut _36: ();
89    let mut _37: ();
90    let mut _38: &mut std::task::Context<'_>;
91    let mut _39: u32;
92    scope 1 {
93        debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
94        let _17: ();
95        scope 2 {
96        }
97        scope 3 {
98            debug result => _17;
99        }
100    }
101    scope 4 {
102        debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
103        let _33: ();
104        scope 5 {
105        }
106        scope 6 {
107            debug result => _33;
108        }
109    }
110
111    bb0: {
112        _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
113        switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
114    }
115
116    bb1: {
117        _38 = move _2;
118        StorageLive(_3);
119        StorageLive(_4);
120        StorageLive(_5);
121        _5 = a() -> [return: bb2, unwind unreachable];
122    }
123
124    bb2: {
125        _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
126    }
127
128    bb3: {
129        StorageDead(_5);
130        nop;
131        (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4;
132        goto -> bb4;
133    }
134
135    bb4: {
136        StorageLive(_8);
137        StorageLive(_9);
138        StorageLive(_10);
139        StorageLive(_11);
140        StorageLive(_12);
141        _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
142        _11 = &mut (*_12);
143        _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
144    }
145
146    bb5: {
147        StorageDead(_11);
148        StorageLive(_13);
149        StorageLive(_14);
150        StorageLive(_15);
151        _15 = _38;
152        _14 = move _15;
153        goto -> bb6;
154    }
155
156    bb6: {
157        _13 = &mut (*_14);
158        StorageDead(_15);
159        _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
160    }
161
162    bb7: {
163        StorageDead(_13);
164        StorageDead(_10);
165        _16 = discriminant(_9);
166        switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9];
167    }
168
169    bb8: {
170        _8 = const ();
171        StorageDead(_14);
172        StorageDead(_12);
173        StorageDead(_9);
174        StorageDead(_8);
175        StorageLive(_19);
176        StorageLive(_20);
177        _20 = ();
178        _0 = Poll::<()>::Pending;
179        discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3;
180        return;
181    }
182
183    bb9: {
184        unreachable;
185    }
186
187    bb10: {
188        StorageLive(_17);
189        _17 = ((_9 as Ready).0: ());
190        _3 = _17;
191        StorageDead(_17);
192        StorageDead(_14);
193        StorageDead(_12);
194        StorageDead(_9);
195        StorageDead(_8);
196        drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable];
197    }
198
199    bb11: {
200        StorageDead(_20);
201        _38 = move _19;
202        StorageDead(_19);
203        _7 = const ();
204        goto -> bb4;
205    }
206
207    bb12: {
208        nop;
209        goto -> bb13;
210    }
211
212    bb13: {
213        StorageDead(_4);
214        StorageDead(_3);
215        StorageLive(_21);
216        StorageLive(_22);
217        _22 = a() -> [return: bb14, unwind unreachable];
218    }
219
220    bb14: {
221        _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
222    }
223
224    bb15: {
225        StorageDead(_22);
226        nop;
227        (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21;
228        goto -> bb16;
229    }
230
231    bb16: {
232        StorageLive(_24);
233        StorageLive(_25);
234        StorageLive(_26);
235        StorageLive(_27);
236        StorageLive(_28);
237        _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
238        _27 = &mut (*_28);
239        _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
240    }
241
242    bb17: {
243        StorageDead(_27);
244        StorageLive(_29);
245        StorageLive(_30);
246        StorageLive(_31);
247        _31 = _38;
248        _30 = move _31;
249        goto -> bb18;
250    }
251
252    bb18: {
253        _29 = &mut (*_30);
254        StorageDead(_31);
255        _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
256    }
257
258    bb19: {
259        StorageDead(_29);
260        StorageDead(_26);
261        _32 = discriminant(_25);
262        switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9];
263    }
264
265    bb20: {
266        _24 = const ();
267        StorageDead(_30);
268        StorageDead(_28);
269        StorageDead(_25);
270        StorageDead(_24);
271        StorageLive(_35);
272        StorageLive(_36);
273        _36 = ();
274        _0 = Poll::<()>::Pending;
275        discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4;
276        return;
277    }
278
279    bb21: {
280        StorageLive(_33);
281        _33 = ((_25 as Ready).0: ());
282        _37 = _33;
283        StorageDead(_33);
284        StorageDead(_30);
285        StorageDead(_28);
286        StorageDead(_25);
287        StorageDead(_24);
288        drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable];
289    }
290
291    bb22: {
292        StorageDead(_36);
293        _38 = move _35;
294        StorageDead(_35);
295        _7 = const ();
296        goto -> bb16;
297    }
298
299    bb23: {
300        nop;
301        goto -> bb24;
302    }
303
304    bb24: {
305        StorageDead(_21);
306        goto -> bb26;
307    }
308
309    bb25: {
310        _0 = Poll::<()>::Ready(move _37);
311        discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1;
312        return;
313    }
314
315    bb26: {
316        goto -> bb25;
317    }
318
319    bb27: {
320        StorageLive(_3);
321        StorageLive(_4);
322        StorageLive(_19);
323        StorageLive(_20);
324        _19 = move _2;
325        goto -> bb11;
326    }
327
328    bb28: {
329        StorageLive(_21);
330        StorageLive(_35);
331        StorageLive(_36);
332        _35 = move _2;
333        goto -> bb22;
334    }
335
336    bb29: {
337        assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
338    }
339
340    bb30: {
341        unreachable;
342    }
343}