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