| - // MIR for `partial_init::{closure#0}` before StateTransform |
| + // MIR for `partial_init::{closure#0}` after StateTransform |
| |
| - fn partial_init::{closure#0}(_1: {async fn body of partial_init()}, _2: std::future::ResumeTy) -> u32 |
| - yields () |
| - { |
| - debug _task_context => _2; |
| - debug x => (_1.0: u32); |
| - let mut _0: u32; |
| + fn partial_init::{closure#0}(_1: Pin<&mut {async fn body of partial_init()}>, _2: &mut Context<'_>) -> Poll<u32> { |
| + coroutine layout { |
| + field _s0: u32; |
| + field _s1: String; |
| + field _s2: {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| + variant_fields = { |
| + Unresumed(0): [], |
| + Returned (1): [], |
| + Panicked (2): [], |
| + Suspend0 (3): [_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 => _29; |
| + debug x => ((*_28).0: u32); |
| + coroutine debug x => _s0; |
| + let mut _0: std::task::Poll<u32>; |
| let _3: u32; |
| let mut _4: !; |
| let mut _6: std::string::String; |
| let mut _7: !; |
| let mut _8: {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| let mut _9: {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| let mut _10: &u32; |
| let mut _12: (); |
| let _13: (); |
| let mut _14: std::task::Poll<u32>; |
| let mut _15: std::pin::Pin<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>; |
| let mut _16: &mut {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| let mut _17: &mut {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| let mut _18: &mut std::task::Context<'_>; |
| let mut _19: &mut std::task::Context<'_>; |
| let mut _20: std::future::ResumeTy; |
| let mut _21: isize; |
| let mut _23: !; |
| let mut _24: std::future::ResumeTy; |
| let mut _25: (); |
| + let mut _26: u32; |
| + let mut _27: u32; |
| + let mut _28: &mut {async fn body of partial_init()}; |
| + let mut _29: std::future::ResumeTy; |
| + let mut _30: std::ptr::NonNull<std::task::Context<'_>>; |
| scope 1 { |
| - debug x => _3; |
| + debug x => (((*_28) as variant#3).0: u32); |
| scope 2 { |
| debug _x => _5; |
| } |
| scope 3 { |
| + coroutine debug __awaitee => _s2; |
| let _5: (std::string::String, !); |
| let mut _11: {async block@$DIR/async_fn.rs:80:50: 80:55}; |
| scope 4 { |
| - debug __awaitee => _11; |
| + debug __awaitee => (((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55}); |
| let _22: u32; |
| scope 5 { |
| debug result => _22; |
| } |
| } |
| } |
| } |
| |
| bb0: { |
| - StorageLive(_3); |
| - _3 = copy (_1.0: u32); |
| - StorageLive(_4); |
| - StorageLive(_5); |
| - StorageLive(_6); |
| - _6 = String::new() -> [return: bb1, unwind: bb30]; |
| + _30 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute); |
| + _29 = std::future::ResumeTy(move _30); |
| + _28 = copy (_1.0: &mut {async fn body of partial_init()}); |
| + _27 = discriminant((*_28)); |
| + switchInt(move _27) -> [0: bb32, 1: bb31, 2: bb30, 3: bb29, otherwise: bb7]; |
| } |
| |
| bb1: { |
| StorageLive(_8); |
| StorageLive(_9); |
| StorageLive(_10); |
| - _10 = &_3; |
| + _10 = &(((*_28) as variant#3).0: u32); |
| _9 = {coroutine@$DIR/async_fn.rs:80:50: 80:55 (#0)} { x: move _10 }; |
| StorageDead(_10); |
| - _8 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as IntoFuture>::into_future(move _9) -> [return: bb2, unwind: bb26]; |
| + _8 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as IntoFuture>::into_future(move _9) -> [return: bb2, unwind: bb20]; |
| } |
| |
| bb2: { |
| StorageDead(_9); |
| PlaceMention(_8); |
| - StorageLive(_11); |
| - _11 = move _8; |
| + nop; |
| + (((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55}) = move _8; |
| goto -> bb3; |
| } |
| |
| bb3: { |
| StorageLive(_13); |
| StorageLive(_14); |
| StorageLive(_15); |
| StorageLive(_16); |
| StorageLive(_17); |
| - _17 = &mut _11; |
| + _17 = &mut (((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55}); |
| _16 = &mut (*_17); |
| - _15 = Pin::<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>::new_unchecked(move _16) -> [return: bb4, unwind: bb22]; |
| + _15 = Pin::<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>::new_unchecked(move _16) -> [return: bb4, unwind: bb16]; |
| } |
| |
| bb4: { |
| StorageDead(_16); |
| StorageLive(_18); |
| StorageLive(_19); |
| StorageLive(_20); |
| - _20 = copy _2; |
| - _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb5, unwind: bb20]; |
| + _20 = copy _29; |
| + _19 = copy (_20.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute); |
| + goto -> bb5; |
| } |
| |
| bb5: { |
| _18 = &mut (*_19); |
| StorageDead(_20); |
| - _14 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as Future>::poll(move _15, move _18) -> [return: bb6, unwind: bb21]; |
| + _14 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as Future>::poll(move _15, move _18) -> [return: bb6, unwind: bb15]; |
| } |
| |
| bb6: { |
| StorageDead(_19); |
| StorageDead(_18); |
| StorageDead(_17); |
| StorageDead(_15); |
| PlaceMention(_14); |
| _21 = discriminant(_14); |
| switchInt(move _21) -> [0: bb9, 1: bb8, otherwise: bb7]; |
| } |
| |
| bb7: { |
| unreachable; |
| } |
| |
| bb8: { |
| _13 = const (); |
| StorageDead(_14); |
| StorageDead(_13); |
| StorageLive(_24); |
| StorageLive(_25); |
| _25 = (); |
| - _24 = yield(move _25) -> [resume: bb10, drop: bb15]; |
| + _0 = Poll::<u32>::Pending; |
| + StorageDead(_4); |
| + StorageDead(_5); |
| + StorageDead(_8); |
| + StorageDead(_24); |
| + StorageDead(_25); |
| + discriminant((*_28)) = 3; |
| + return; |
| } |
| |
| bb9: { |
| StorageLive(_22); |
| _22 = copy ((_14 as Ready).0: u32); |
| - _0 = copy _22; |
| + _26 = copy _22; |
| StorageDead(_22); |
| StorageDead(_14); |
| StorageDead(_13); |
| - drop(_11) -> [return: bb11, unwind: bb24]; |
| + drop((((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55})) -> [return: bb11, unwind: bb18]; |
| } |
| |
| bb10: { |
| StorageDead(_25); |
| - _2 = move _24; |
| + _29 = move _24; |
| StorageDead(_24); |
| _12 = const (); |
| goto -> bb3; |
| } |
| |
| bb11: { |
| - StorageDead(_11); |
| - drop(_6) -> [return: bb12, unwind: bb25]; |
| + nop; |
| + drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb12, unwind: bb19]; |
| } |
| |
| bb12: { |
| - StorageDead(_6); |
| + nop; |
| goto -> bb13; |
| } |
| |
| bb13: { |
| StorageDead(_8); |
| StorageDead(_5); |
| StorageDead(_4); |
| - StorageDead(_3); |
| - drop(_1) -> [return: bb14, unwind: bb32]; |
| + nop; |
| + goto -> bb27; |
| } |
| |
| bb14: { |
| + _0 = Poll::<u32>::Ready(move _26); |
| + discriminant((*_28)) = 1; |
| return; |
| } |
| |
| - bb15: { |
| - StorageDead(_25); |
| - StorageDead(_24); |
| - drop(_11) -> [return: bb16, unwind: bb33]; |
| + bb15 (cleanup): { |
| + StorageDead(_19); |
| + StorageDead(_18); |
| + goto -> bb17; |
| } |
| |
| - bb16: { |
| - StorageDead(_11); |
| - drop(_6) -> [return: bb17, unwind: bb34]; |
| + bb16 (cleanup): { |
| + StorageDead(_16); |
| + goto -> bb17; |
| } |
| |
| - bb17: { |
| - StorageDead(_6); |
| - goto -> bb18; |
| + bb17 (cleanup): { |
| + StorageDead(_17); |
| + StorageDead(_15); |
| + StorageDead(_14); |
| + StorageDead(_13); |
| + drop((((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55})) -> [return: bb18, unwind terminate(cleanup)]; |
| } |
| |
| - bb18: { |
| - StorageDead(_8); |
| - StorageDead(_5); |
| - StorageDead(_4); |
| - StorageDead(_3); |
| - drop(_1) -> [return: bb19, unwind: bb32]; |
| + bb18 (cleanup): { |
| + nop; |
| + drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb19, unwind terminate(cleanup)]; |
| } |
| |
| - bb19: { |
| - coroutine_drop; |
| + bb19 (cleanup): { |
| + nop; |
| + goto -> bb23; |
| } |
| |
| bb20 (cleanup): { |
| - StorageDead(_20); |
| goto -> bb21; |
| } |
| |
| bb21 (cleanup): { |
| - StorageDead(_19); |
| - StorageDead(_18); |
| - goto -> bb23; |
| + StorageDead(_9); |
| + drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb22, unwind terminate(cleanup)]; |
| } |
| |
| bb22 (cleanup): { |
| - StorageDead(_16); |
| + nop; |
| goto -> bb23; |
| } |
| |
| bb23 (cleanup): { |
| - StorageDead(_17); |
| - StorageDead(_15); |
| - StorageDead(_14); |
| - StorageDead(_13); |
| - drop(_11) -> [return: bb24, unwind terminate(cleanup)]; |
| + StorageDead(_8); |
| + goto -> bb25; |
| } |
| |
| bb24 (cleanup): { |
| - StorageDead(_11); |
| - drop(_6) -> [return: bb25, unwind terminate(cleanup)]; |
| + nop; |
| + goto -> bb25; |
| } |
| |
| bb25 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb29; |
| + StorageDead(_5); |
| + StorageDead(_4); |
| + nop; |
| + goto -> bb26; |
| } |
| |
| bb26 (cleanup): { |
| - goto -> bb27; |
| + goto -> bb28; |
| } |
| |
| - bb27 (cleanup): { |
| - StorageDead(_9); |
| - drop(_6) -> [return: bb28, unwind terminate(cleanup)]; |
| + bb27: { |
| + goto -> bb14; |
| } |
| |
| bb28 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb29; |
| + discriminant((*_28)) = 2; |
| + resume; |
| } |
| |
| - bb29 (cleanup): { |
| - StorageDead(_8); |
| - goto -> bb31; |
| + bb29: { |
| + StorageLive(_4); |
| + StorageLive(_5); |
| + StorageLive(_8); |
| + StorageLive(_24); |
| + StorageLive(_25); |
| + _24 = move _29; |
| + goto -> bb10; |
| } |
| |
| - bb30 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb31; |
| + bb30: { |
| + assert(const false, "`async fn` resumed after panicking") -> [success: bb30, unwind continue]; |
| } |
| |
| - bb31 (cleanup): { |
| - StorageDead(_5); |
| - StorageDead(_4); |
| - StorageDead(_3); |
| - drop(_1) -> [return: bb32, unwind terminate(cleanup)]; |
| + bb31: { |
| + assert(const false, "`async fn` resumed after completion") -> [success: bb31, unwind continue]; |
| } |
| |
| - bb32 (cleanup): { |
| - resume; |
| - } |
| - |
| - bb33 (cleanup): { |
| - StorageDead(_11); |
| - drop(_6) -> [return: bb34, unwind terminate(cleanup)]; |
| - } |
| - |
| - bb34 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb35; |
| - } |
| - |
| - bb35 (cleanup): { |
| - StorageDead(_8); |
| - StorageDead(_5); |
| - StorageDead(_4); |
| - StorageDead(_3); |
| - drop(_1) -> [return: bb32, unwind terminate(cleanup)]; |
| + bb32: { |
| + nop; |
| + (((*_28) as variant#3).0: u32) = copy ((*_28).0: u32); |
| + StorageLive(_4); |
| + StorageLive(_5); |
| + nop; |
| + (((*_28) as variant#3).1: std::string::String) = String::new() -> [return: bb1, unwind: bb24]; |
| } |
| } |
| |