]> git.proxmox.com Git - rustc.git/blob - tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / mir-opt / building / async_await.b-{closure#0}.coroutine_resume.0.mir
1 // MIR for `b::{closure#0}` 0 coroutine_resume
2 /* coroutine_layout = CoroutineLayout {
3 field_tys: {
4 _0: CoroutineSavedTy {
5 ty: Coroutine(
6 DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
7 [
8 std::future::ResumeTy,
9 (),
10 (),
11 CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
12 (),
13 ],
14 Static,
15 ),
16 source_info: SourceInfo {
17 span: $DIR/async_await.rs:16:9: 16:14 (#8),
18 scope: scope[0],
19 },
20 ignore_for_traits: false,
21 },
22 _1: CoroutineSavedTy {
23 ty: Coroutine(
24 DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
25 [
26 std::future::ResumeTy,
27 (),
28 (),
29 CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
30 (),
31 ],
32 Static,
33 ),
34 source_info: SourceInfo {
35 span: $DIR/async_await.rs:17:9: 17: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
54 fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18: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:12:14: 12:16};
59 let mut _5: {async fn body@$DIR/async_await.rs:12:14: 12:16};
60 let mut _6: {async fn body@$DIR/async_await.rs:12:14: 12: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:12:14: 12:16}>;
65 let mut _11: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
66 let mut _12: &mut {async fn body@$DIR/async_await.rs:12:14: 12: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:12:14: 12:16};
75 let mut _22: {async fn body@$DIR/async_await.rs:12:14: 12:16};
76 let mut _23: {async fn body@$DIR/async_await.rs:12:14: 12: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:12:14: 12:16}>;
80 let mut _27: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
81 let mut _28: &mut {async fn body@$DIR/async_await.rs:12:14: 12: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:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12: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:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12: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:15:18: 18: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:12:14: 12:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
126 }
127
128 bb3: {
129 StorageDead(_5);
130 PlaceMention(_4);
131 nop;
132 (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _4;
133 goto -> bb4;
134 }
135
136 bb4: {
137 StorageLive(_8);
138 StorageLive(_9);
139 StorageLive(_10);
140 StorageLive(_11);
141 StorageLive(_12);
142 _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
143 _11 = &mut (*_12);
144 _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
145 }
146
147 bb5: {
148 StorageDead(_11);
149 StorageLive(_13);
150 StorageLive(_14);
151 StorageLive(_15);
152 _15 = _38;
153 _14 = move _15;
154 goto -> bb6;
155 }
156
157 bb6: {
158 _13 = &mut (*_14);
159 StorageDead(_15);
160 _9 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
161 }
162
163 bb7: {
164 StorageDead(_13);
165 StorageDead(_10);
166 PlaceMention(_9);
167 _16 = discriminant(_9);
168 switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9];
169 }
170
171 bb8: {
172 _8 = const ();
173 StorageDead(_14);
174 StorageDead(_12);
175 StorageDead(_9);
176 StorageDead(_8);
177 StorageLive(_19);
178 StorageLive(_20);
179 _20 = ();
180 _0 = Poll::<()>::Pending;
181 discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 3;
182 return;
183 }
184
185 bb9: {
186 unreachable;
187 }
188
189 bb10: {
190 StorageLive(_17);
191 _17 = ((_9 as Ready).0: ());
192 _3 = _17;
193 StorageDead(_17);
194 StorageDead(_14);
195 StorageDead(_12);
196 StorageDead(_9);
197 StorageDead(_8);
198 drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb12, unwind unreachable];
199 }
200
201 bb11: {
202 StorageDead(_20);
203 _38 = move _19;
204 StorageDead(_19);
205 _7 = const ();
206 goto -> bb4;
207 }
208
209 bb12: {
210 nop;
211 goto -> bb13;
212 }
213
214 bb13: {
215 StorageDead(_4);
216 StorageDead(_3);
217 StorageLive(_21);
218 StorageLive(_22);
219 _22 = a() -> [return: bb14, unwind unreachable];
220 }
221
222 bb14: {
223 _21 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
224 }
225
226 bb15: {
227 StorageDead(_22);
228 PlaceMention(_21);
229 nop;
230 (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _21;
231 goto -> bb16;
232 }
233
234 bb16: {
235 StorageLive(_24);
236 StorageLive(_25);
237 StorageLive(_26);
238 StorageLive(_27);
239 StorageLive(_28);
240 _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
241 _27 = &mut (*_28);
242 _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
243 }
244
245 bb17: {
246 StorageDead(_27);
247 StorageLive(_29);
248 StorageLive(_30);
249 StorageLive(_31);
250 _31 = _38;
251 _30 = move _31;
252 goto -> bb18;
253 }
254
255 bb18: {
256 _29 = &mut (*_30);
257 StorageDead(_31);
258 _25 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
259 }
260
261 bb19: {
262 StorageDead(_29);
263 StorageDead(_26);
264 PlaceMention(_25);
265 _32 = discriminant(_25);
266 switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9];
267 }
268
269 bb20: {
270 _24 = const ();
271 StorageDead(_30);
272 StorageDead(_28);
273 StorageDead(_25);
274 StorageDead(_24);
275 StorageLive(_35);
276 StorageLive(_36);
277 _36 = ();
278 _0 = Poll::<()>::Pending;
279 discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 4;
280 return;
281 }
282
283 bb21: {
284 StorageLive(_33);
285 _33 = ((_25 as Ready).0: ());
286 _37 = _33;
287 StorageDead(_33);
288 StorageDead(_30);
289 StorageDead(_28);
290 StorageDead(_25);
291 StorageDead(_24);
292 drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb23, unwind unreachable];
293 }
294
295 bb22: {
296 StorageDead(_36);
297 _38 = move _35;
298 StorageDead(_35);
299 _7 = const ();
300 goto -> bb16;
301 }
302
303 bb23: {
304 nop;
305 goto -> bb24;
306 }
307
308 bb24: {
309 StorageDead(_21);
310 goto -> bb26;
311 }
312
313 bb25: {
314 _0 = Poll::<()>::Ready(move _37);
315 discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 1;
316 return;
317 }
318
319 bb26: {
320 goto -> bb25;
321 }
322
323 bb27: {
324 StorageLive(_3);
325 StorageLive(_4);
326 StorageLive(_19);
327 StorageLive(_20);
328 _19 = move _2;
329 goto -> bb11;
330 }
331
332 bb28: {
333 StorageLive(_21);
334 StorageLive(_35);
335 StorageLive(_36);
336 _35 = move _2;
337 goto -> bb22;
338 }
339
340 bb29: {
341 assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
342 }
343
344 bb30: {
345 unreachable;
346 }
347 }