blob: b902c7c048048129da6cac40b9aeb4c0290c175c [file]
- // MIR for `foo::{closure#0}::{closure#0}` before StateTransform
+ // MIR for `foo::{closure#0}::{closure#0}` after StateTransform
- fn foo::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:21:13: 21:18}, _2: std::future::ResumeTy) -> u32
- yields ()
- {
+ fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>, _2: &mut Context<'_>) -> Poll<u32> {
+ coroutine layout {
+ variant_fields = {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ }
+ storage_conflicts = BitMatrix(0x0) {}
+ }
debug _task_context => _2;
- debug y => (*(_1.0: &u32));
- debug z => (*(_1.1: &u32));
- let mut _0: u32;
+ debug y => (*((*_9).0: &u32));
+ debug z => (*((*_9).1: &u32));
+ let mut _0: std::task::Poll<u32>;
let mut _3: u32;
let mut _4: u32;
let mut _5: &u32;
let mut _6: &u32;
+ let mut _7: u32;
+ let mut _8: u32;
+ let mut _9: &mut {async block@$DIR/async_fn.rs:21:13: 21:18};
bb0: {
- StorageLive(_3);
- _5 = no_retag copy (_1.0: &u32);
- _3 = copy (*_5);
- StorageLive(_4);
- _6 = no_retag copy (_1.1: &u32);
- _4 = copy (*_6);
- _0 = Add(move _3, move _4);
- StorageDead(_4);
- StorageDead(_3);
- drop(_1) -> [return: bb1, unwind: bb2];
+ _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:21:13: 21:18});
+ _8 = discriminant((*_9));
+ switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
}
bb1: {
+ _0 = Poll::<u32>::Ready(move _7);
+ discriminant((*_9)) = 1;
return;
}
- bb2 (cleanup): {
- resume;
+ bb2: {
+ goto -> bb1;
+ }
+
+ bb3: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb3, unwind continue];
+ }
+
+ bb4: {
+ unreachable;
+ }
+
+ bb5: {
+ StorageLive(_3);
+ _5 = no_retag copy ((*_9).0: &u32);
+ _3 = copy (*_5);
+ StorageLive(_4);
+ _6 = no_retag copy ((*_9).1: &u32);
+ _4 = copy (*_6);
+ _7 = Add(move _3, move _4);
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb2;
}
}