mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-02 09:47:57 +00:00
285 lines
8.7 KiB
Diff
285 lines
8.7 KiB
Diff
- // MIR for `simple::{closure#0}` before StateTransform
|
|
+ // MIR for `simple::{closure#0}` after StateTransform
|
|
|
|
- fn simple::{closure#0}(_1: {async fn body of simple()}, _2: std::future::ResumeTy) -> ()
|
|
- yields ()
|
|
- {
|
|
- debug _task_context => _2;
|
|
- let mut _0: ();
|
|
+ fn simple::{closure#0}(_1: Pin<&mut {async fn body of simple()}>, _2: &mut Context<'_>) -> Poll<()> {
|
|
+ coroutine layout {
|
|
+ field _s0: ();
|
|
+ field _s1: SyncInt;
|
|
+ field _s2: AsyncInt;
|
|
+ field _s3: impl Future<Output = ()>;
|
|
+ variant_fields = {
|
|
+ Unresumed(0): [],
|
|
+ Returned (1): [],
|
|
+ Panicked (2): [],
|
|
+ Suspend0 (3): [_s1, _s2, _s3],
|
|
+ Suspend1 (4): [_s0, _s1, _s2, _s3],
|
|
+ }
|
|
+ storage_conflicts = BitMatrix(4x4) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3)}
|
|
+ }
|
|
+ debug _task_context => _25;
|
|
+ coroutine debug sync_int => _s1;
|
|
+ let mut _0: std::task::Poll<()>;
|
|
let _3: SyncInt;
|
|
let mut _5: impl std::future::Future<Output = ()>;
|
|
let mut _6: std::future::ResumeTy;
|
|
let mut _7: std::task::Poll<()>;
|
|
let mut _8: isize;
|
|
let mut _9: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
|
|
let mut _10: &mut std::task::Context<'_>;
|
|
let mut _11: std::future::ResumeTy;
|
|
let mut _12: &mut impl std::future::Future<Output = ()>;
|
|
let mut _13: std::future::ResumeTy;
|
|
let mut _14: std::task::Poll<()>;
|
|
let mut _15: isize;
|
|
let mut _16: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
|
|
let mut _17: &mut std::task::Context<'_>;
|
|
let mut _18: std::future::ResumeTy;
|
|
let mut _19: &mut impl std::future::Future<Output = ()>;
|
|
let mut _20: std::pin::Pin<&mut AsyncInt>;
|
|
let mut _21: &mut AsyncInt;
|
|
+ let mut _22: ();
|
|
+ let mut _23: u32;
|
|
+ let mut _24: &mut {async fn body of simple()};
|
|
+ let mut _25: std::future::ResumeTy;
|
|
+ let mut _26: std::ptr::NonNull<std::task::Context<'_>>;
|
|
scope 1 {
|
|
- debug sync_int => _3;
|
|
+ debug sync_int => (((*_24) as variant#4).1: SyncInt);
|
|
+ coroutine debug async_int => _s2;
|
|
let _4: AsyncInt;
|
|
scope 2 {
|
|
- debug async_int => _4;
|
|
+ debug async_int => (((*_24) as variant#4).2: AsyncInt);
|
|
}
|
|
}
|
|
|
|
bb0: {
|
|
- StorageLive(_3);
|
|
- _3 = SyncInt(const 0_i32);
|
|
- StorageLive(_4);
|
|
- _4 = AsyncInt(const 0_i32);
|
|
- _0 = const ();
|
|
- goto -> bb30;
|
|
+ _26 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
|
|
+ _25 = std::future::ResumeTy(move _26);
|
|
+ _24 = copy (_1.0: &mut {async fn body of simple()});
|
|
+ _23 = discriminant((*_24));
|
|
+ switchInt(move _23) -> [0: bb25, 1: bb24, 2: bb23, 3: bb21, 4: bb22, otherwise: bb11];
|
|
}
|
|
|
|
bb1: {
|
|
- StorageDead(_4);
|
|
- drop(_3) -> [return: bb2, unwind: bb8];
|
|
+ nop;
|
|
+ drop((((*_24) as variant#4).1: SyncInt)) -> [return: bb2, unwind: bb5];
|
|
}
|
|
|
|
bb2: {
|
|
- StorageDead(_3);
|
|
- drop(_1) -> [return: bb3, unwind: bb9];
|
|
+ nop;
|
|
+ goto -> bb3;
|
|
}
|
|
|
|
bb3: {
|
|
+ _0 = Poll::<()>::Ready(move (((*_24) as variant#4).0: ()));
|
|
+ discriminant((*_24)) = 1;
|
|
return;
|
|
}
|
|
|
|
- bb4: {
|
|
- StorageDead(_4);
|
|
- goto -> bb5;
|
|
+ bb4 (cleanup): {
|
|
+ nop;
|
|
+ drop((((*_24) as variant#4).1: SyncInt)) -> [return: bb5, unwind terminate(cleanup)];
|
|
}
|
|
|
|
- bb5: {
|
|
- StorageDead(_3);
|
|
+ bb5 (cleanup): {
|
|
+ nop;
|
|
goto -> bb6;
|
|
}
|
|
|
|
- bb6: {
|
|
- coroutine_drop;
|
|
+ bb6 (cleanup): {
|
|
+ goto -> bb20;
|
|
}
|
|
|
|
- bb7 (cleanup): {
|
|
- StorageDead(_4);
|
|
- drop(_3) -> [return: bb8, unwind terminate(cleanup)];
|
|
+ bb7: {
|
|
+ nop;
|
|
+ goto -> bb1;
|
|
}
|
|
|
|
bb8 (cleanup): {
|
|
- StorageDead(_3);
|
|
- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
|
|
+ nop;
|
|
+ goto -> bb4;
|
|
}
|
|
|
|
- bb9 (cleanup): {
|
|
- resume;
|
|
+ bb9: {
|
|
+ assert(const false, "`async fn` resumed after async drop") -> [success: bb9, unwind: bb8];
|
|
}
|
|
|
|
bb10: {
|
|
- StorageDead(_5);
|
|
- goto -> bb1;
|
|
+ _25 = move _6;
|
|
+ StorageDead(_6);
|
|
+ goto -> bb9;
|
|
}
|
|
|
|
bb11: {
|
|
- StorageDead(_5);
|
|
- goto -> bb4;
|
|
+ unreachable;
|
|
}
|
|
|
|
- bb12 (cleanup): {
|
|
- StorageDead(_5);
|
|
- goto -> bb7;
|
|
+ bb12: {
|
|
+ _25 = move _13;
|
|
+ StorageDead(_13);
|
|
+ goto -> bb17;
|
|
}
|
|
|
|
bb13: {
|
|
- assert(const false, "`async fn` resumed after async drop") -> [success: bb13, unwind: bb12];
|
|
+ StorageLive(_13);
|
|
+ _0 = Poll::<()>::Pending;
|
|
+ StorageDead(_13);
|
|
+ discriminant((*_24)) = 4;
|
|
+ return;
|
|
}
|
|
|
|
bb14: {
|
|
- _2 = move _6;
|
|
- StorageDead(_6);
|
|
- goto -> bb13;
|
|
+ _15 = discriminant(_14);
|
|
+ switchInt(move _15) -> [0: bb7, 1: bb13, otherwise: bb11];
|
|
}
|
|
|
|
bb15: {
|
|
- _2 = move _6;
|
|
- StorageDead(_6);
|
|
- goto -> bb21;
|
|
+ _14 = <impl Future<Output = ()> as Future>::poll(move _16, move _17) -> [return: bb14, unwind: bb8];
|
|
}
|
|
|
|
bb16: {
|
|
- StorageLive(_6);
|
|
- _6 = yield(const ()) -> [resume: bb14, drop: bb15];
|
|
+ _18 = move _25;
|
|
+ _17 = copy (_18.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
|
|
+ goto -> bb15;
|
|
}
|
|
|
|
bb17: {
|
|
- unreachable;
|
|
+ _19 = &mut (((*_24) as variant#4).3: impl std::future::Future<Output = ()>);
|
|
+ _16 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _19) -> [return: bb16, unwind: bb8];
|
|
}
|
|
|
|
bb18: {
|
|
- _8 = discriminant(_7);
|
|
- switchInt(move _8) -> [0: bb11, 1: bb16, otherwise: bb17];
|
|
+ nop;
|
|
+ (((*_24) as variant#4).3: impl std::future::Future<Output = ()>) = async_drop_in_place::<AsyncInt>(copy (_20.0: &mut AsyncInt)) -> [return: bb17, unwind: bb8];
|
|
}
|
|
|
|
bb19: {
|
|
- _7 = <impl Future<Output = ()> as Future>::poll(move _9, move _10) -> [return: bb18, unwind: bb12];
|
|
+ _21 = &mut (((*_24) as variant#4).2: AsyncInt);
|
|
+ _20 = Pin::<&mut AsyncInt>::new_unchecked(move _21) -> [return: bb18, unwind: bb4];
|
|
}
|
|
|
|
- bb20: {
|
|
- _11 = move _2;
|
|
- _10 = std::future::get_context::<'_, '_>(move _11) -> [return: bb19, unwind: bb12];
|
|
+ bb20 (cleanup): {
|
|
+ discriminant((*_24)) = 2;
|
|
+ resume;
|
|
}
|
|
|
|
bb21: {
|
|
- _12 = &mut _5;
|
|
- _9 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _12) -> [return: bb20, unwind: bb12];
|
|
+ StorageLive(_6);
|
|
+ _6 = move _25;
|
|
+ goto -> bb10;
|
|
}
|
|
|
|
bb22: {
|
|
- _2 = move _13;
|
|
- StorageDead(_13);
|
|
- goto -> bb28;
|
|
+ StorageLive(_13);
|
|
+ _13 = move _25;
|
|
+ goto -> bb12;
|
|
}
|
|
|
|
bb23: {
|
|
- _2 = move _13;
|
|
- StorageDead(_13);
|
|
- goto -> bb21;
|
|
+ assert(const false, "`async fn` resumed after panicking") -> [success: bb23, unwind continue];
|
|
}
|
|
|
|
bb24: {
|
|
- StorageLive(_13);
|
|
- _13 = yield(const ()) -> [resume: bb22, drop: bb23];
|
|
+ assert(const false, "`async fn` resumed after completion") -> [success: bb24, unwind continue];
|
|
}
|
|
|
|
bb25: {
|
|
- _15 = discriminant(_14);
|
|
- switchInt(move _15) -> [0: bb10, 1: bb24, otherwise: bb17];
|
|
- }
|
|
-
|
|
- bb26: {
|
|
- _14 = <impl Future<Output = ()> as Future>::poll(move _16, move _17) -> [return: bb25, unwind: bb12];
|
|
- }
|
|
-
|
|
- bb27: {
|
|
- _18 = move _2;
|
|
- _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb26, unwind: bb12];
|
|
- }
|
|
-
|
|
- bb28: {
|
|
- _19 = &mut _5;
|
|
- _16 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _19) -> [return: bb27, unwind: bb12];
|
|
- }
|
|
-
|
|
- bb29: {
|
|
- StorageLive(_5);
|
|
- _5 = async_drop_in_place::<AsyncInt>(copy (_20.0: &mut AsyncInt)) -> [return: bb28, unwind: bb12];
|
|
- }
|
|
-
|
|
- bb30: {
|
|
- _21 = &mut _4;
|
|
- _20 = Pin::<&mut AsyncInt>::new_unchecked(move _21) -> [return: bb29, unwind: bb7];
|
|
+ nop;
|
|
+ (((*_24) as variant#4).1: SyncInt) = SyncInt(const 0_i32);
|
|
+ nop;
|
|
+ (((*_24) as variant#4).2: AsyncInt) = AsyncInt(const 0_i32);
|
|
+ (((*_24) as variant#4).0: ()) = const ();
|
|
+ goto -> bb19;
|
|
}
|
|
}
|
|
|