| - // MIR for `b::{closure#0}` before StateTransform |
| + // MIR for `b::{closure#0}` after StateTransform |
| |
| - fn b::{closure#0}(_1: {async fn body of b()}, _2: std::future::ResumeTy) -> () |
| - yields () |
| - { |
| + fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> Poll<()> { |
| + coroutine layout { |
| + field _s0: {async fn body of a()}; |
| + field _s1: {async fn body of a()}; |
| + variant_fields = { |
| + Unresumed(0): [], |
| + Returned (1): [], |
| + Panicked (2): [], |
| + Suspend0 (3): [_s0], |
| + Suspend1 (4): [_s1], |
| + } |
| + storage_conflicts = BitMatrix(2x2) {(_s0, _s0), (_s1, _s1)} |
| + } |
| debug _task_context => _2; |
| - let mut _0: (); |
| + coroutine debug __awaitee => _s0; |
| + coroutine debug __awaitee => _s1; |
| + let mut _0: std::task::Poll<()>; |
| let _3: (); |
| let mut _4: {async fn body of a()}; |
| let mut _5: {async fn body of a()}; |
| let mut _6: {async fn body of a()}; |
| let mut _7: (); |
| let _8: (); |
| let mut _9: std::task::Poll<()>; |
| let mut _10: std::pin::Pin<&mut {async fn body of a()}>; |
| let mut _11: &mut {async fn body of a()}; |
| let mut _12: &mut {async fn body of a()}; |
| let mut _13: &mut std::task::Context<'_>; |
| let mut _14: &mut std::task::Context<'_>; |
| - let mut _15: std::future::ResumeTy; |
| + let mut _15: &mut std::task::Context<'_>; |
| let mut _16: isize; |
| let mut _18: !; |
| - let mut _19: std::future::ResumeTy; |
| + let mut _19: &mut std::task::Context<'_>; |
| let mut _20: (); |
| let mut _21: {async fn body of a()}; |
| let mut _22: {async fn body of a()}; |
| let mut _23: {async fn body of a()}; |
| let _24: (); |
| let mut _25: std::task::Poll<()>; |
| let mut _26: std::pin::Pin<&mut {async fn body of a()}>; |
| let mut _27: &mut {async fn body of a()}; |
| let mut _28: &mut {async fn body of a()}; |
| let mut _29: &mut std::task::Context<'_>; |
| let mut _30: &mut std::task::Context<'_>; |
| - let mut _31: std::future::ResumeTy; |
| + let mut _31: &mut std::task::Context<'_>; |
| let mut _32: isize; |
| let mut _34: !; |
| - let mut _35: std::future::ResumeTy; |
| + let mut _35: &mut std::task::Context<'_>; |
| let mut _36: (); |
| + let mut _37: (); |
| + let mut _38: u32; |
| + let mut _39: &mut {async fn body of b()}; |
| scope 1 { |
| - debug __awaitee => _6; |
| + debug __awaitee => (((*_39) as variant#3).0: {async fn body of a()}); |
| let _17: (); |
| scope 2 { |
| debug result => _17; |
| } |
| } |
| scope 3 { |
| - debug __awaitee => _23; |
| + debug __awaitee => (((*_39) as variant#4).0: {async fn body of a()}); |
| let _33: (); |
| scope 4 { |
| debug result => _33; |
| } |
| } |
| |
| bb0: { |
| - StorageLive(_3); |
| - StorageLive(_4); |
| - StorageLive(_5); |
| - _5 = a() -> [return: bb1, unwind: bb47]; |
| + _39 = copy (_1.0: &mut {async fn body of b()}); |
| + _38 = discriminant((*_39)); |
| + switchInt(move _38) -> [0: bb47, 1: bb46, 2: bb45, 3: bb43, 4: bb44, otherwise: bb7]; |
| } |
| |
| bb1: { |
| - _4 = <{async fn body of a()} as IntoFuture>::into_future(move _5) -> [return: bb2, unwind: bb46]; |
| + _4 = <{async fn body of a()} as IntoFuture>::into_future(move _5) -> [return: bb2, unwind: bb36]; |
| } |
| |
| bb2: { |
| StorageDead(_5); |
| PlaceMention(_4); |
| - StorageLive(_6); |
| - _6 = move _4; |
| + nop; |
| + (((*_39) as variant#3).0: {async fn body of a()}) = move _4; |
| goto -> bb3; |
| } |
| |
| bb3: { |
| StorageLive(_8); |
| StorageLive(_9); |
| StorageLive(_10); |
| StorageLive(_11); |
| StorageLive(_12); |
| - _12 = &mut _6; |
| + _12 = &mut (((*_39) as variant#3).0: {async fn body of a()}); |
| _11 = &mut (*_12); |
| - _10 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _11) -> [return: bb4, unwind: bb43]; |
| + _10 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _11) -> [return: bb4, unwind: bb33]; |
| } |
| |
| bb4: { |
| StorageDead(_11); |
| StorageLive(_13); |
| StorageLive(_14); |
| StorageLive(_15); |
| _15 = copy _2; |
| - _14 = std::future::get_context::<'_, '_>(move _15) -> [return: bb5, unwind: bb41]; |
| + _14 = move _15; |
| + goto -> bb5; |
| } |
| |
| bb5: { |
| _13 = &mut (*_14); |
| StorageDead(_15); |
| - _9 = <{async fn body of a()} as Future>::poll(move _10, move _13) -> [return: bb6, unwind: bb42]; |
| + _9 = <{async fn body of a()} as Future>::poll(move _10, move _13) -> [return: bb6, unwind: bb32]; |
| } |
| |
| bb6: { |
| StorageDead(_13); |
| StorageDead(_10); |
| PlaceMention(_9); |
| _16 = discriminant(_9); |
| switchInt(move _16) -> [0: bb9, 1: bb8, otherwise: bb7]; |
| } |
| |
| bb7: { |
| unreachable; |
| } |
| |
| bb8: { |
| _8 = const (); |
| StorageDead(_14); |
| StorageDead(_12); |
| StorageDead(_9); |
| StorageDead(_8); |
| StorageLive(_19); |
| StorageLive(_20); |
| _20 = (); |
| - _19 = yield(move _20) -> [resume: bb10, drop: bb28]; |
| + _0 = Poll::<()>::Pending; |
| + StorageDead(_3); |
| + StorageDead(_4); |
| + StorageDead(_19); |
| + StorageDead(_20); |
| + discriminant((*_39)) = 3; |
| + return; |
| } |
| |
| bb9: { |
| StorageLive(_17); |
| _17 = copy ((_9 as Ready).0: ()); |
| _3 = copy _17; |
| StorageDead(_17); |
| StorageDead(_14); |
| StorageDead(_12); |
| StorageDead(_9); |
| StorageDead(_8); |
| - drop(_6) -> [return: bb11, unwind: bb45]; |
| + drop((((*_39) as variant#3).0: {async fn body of a()})) -> [return: bb11, unwind: bb35]; |
| } |
| |
| bb10: { |
| StorageDead(_20); |
| _2 = move _19; |
| StorageDead(_19); |
| _7 = const (); |
| goto -> bb3; |
| } |
| |
| bb11: { |
| - StorageDead(_6); |
| + nop; |
| goto -> bb12; |
| } |
| |
| bb12: { |
| StorageDead(_4); |
| StorageDead(_3); |
| StorageLive(_21); |
| StorageLive(_22); |
| - _22 = a() -> [return: bb13, unwind: bb39]; |
| + _22 = a() -> [return: bb13, unwind: bb30]; |
| } |
| |
| bb13: { |
| - _21 = <{async fn body of a()} as IntoFuture>::into_future(move _22) -> [return: bb14, unwind: bb38]; |
| + _21 = <{async fn body of a()} as IntoFuture>::into_future(move _22) -> [return: bb14, unwind: bb29]; |
| } |
| |
| bb14: { |
| StorageDead(_22); |
| PlaceMention(_21); |
| - StorageLive(_23); |
| - _23 = move _21; |
| + nop; |
| + (((*_39) as variant#4).0: {async fn body of a()}) = move _21; |
| goto -> bb15; |
| } |
| |
| bb15: { |
| StorageLive(_24); |
| StorageLive(_25); |
| StorageLive(_26); |
| StorageLive(_27); |
| StorageLive(_28); |
| - _28 = &mut _23; |
| + _28 = &mut (((*_39) as variant#4).0: {async fn body of a()}); |
| _27 = &mut (*_28); |
| - _26 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _27) -> [return: bb16, unwind: bb35]; |
| + _26 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _27) -> [return: bb16, unwind: bb26]; |
| } |
| |
| bb16: { |
| StorageDead(_27); |
| StorageLive(_29); |
| StorageLive(_30); |
| StorageLive(_31); |
| _31 = copy _2; |
| - _30 = std::future::get_context::<'_, '_>(move _31) -> [return: bb17, unwind: bb33]; |
| + _30 = move _31; |
| + goto -> bb17; |
| } |
| |
| bb17: { |
| _29 = &mut (*_30); |
| StorageDead(_31); |
| - _25 = <{async fn body of a()} as Future>::poll(move _26, move _29) -> [return: bb18, unwind: bb34]; |
| + _25 = <{async fn body of a()} as Future>::poll(move _26, move _29) -> [return: bb18, unwind: bb25]; |
| } |
| |
| bb18: { |
| StorageDead(_29); |
| StorageDead(_26); |
| PlaceMention(_25); |
| _32 = discriminant(_25); |
| switchInt(move _32) -> [0: bb20, 1: bb19, otherwise: bb7]; |
| } |
| |
| bb19: { |
| _24 = const (); |
| StorageDead(_30); |
| StorageDead(_28); |
| StorageDead(_25); |
| StorageDead(_24); |
| StorageLive(_35); |
| StorageLive(_36); |
| _36 = (); |
| - _35 = yield(move _36) -> [resume: bb21, drop: bb25]; |
| + _0 = Poll::<()>::Pending; |
| + StorageDead(_21); |
| + StorageDead(_35); |
| + StorageDead(_36); |
| + discriminant((*_39)) = 4; |
| + return; |
| } |
| |
| bb20: { |
| StorageLive(_33); |
| _33 = copy ((_25 as Ready).0: ()); |
| - _0 = copy _33; |
| + _37 = copy _33; |
| StorageDead(_33); |
| StorageDead(_30); |
| StorageDead(_28); |
| StorageDead(_25); |
| StorageDead(_24); |
| - drop(_23) -> [return: bb22, unwind: bb37]; |
| + drop((((*_39) as variant#4).0: {async fn body of a()})) -> [return: bb22, unwind: bb28]; |
| } |
| |
| bb21: { |
| StorageDead(_36); |
| _2 = move _35; |
| StorageDead(_35); |
| _7 = const (); |
| goto -> bb15; |
| } |
| |
| bb22: { |
| - StorageDead(_23); |
| + nop; |
| goto -> bb23; |
| } |
| |
| bb23: { |
| StorageDead(_21); |
| - drop(_1) -> [return: bb24, unwind: bb50]; |
| + goto -> bb41; |
| } |
| |
| bb24: { |
| + _0 = Poll::<()>::Ready(move _37); |
| + discriminant((*_39)) = 1; |
| return; |
| } |
| |
| - bb25: { |
| - StorageDead(_36); |
| - StorageDead(_35); |
| - drop(_23) -> [return: bb26, unwind: bb51]; |
| - } |
| - |
| - bb26: { |
| - StorageDead(_23); |
| - goto -> bb27; |
| - } |
| - |
| - bb27: { |
| - StorageDead(_21); |
| - goto -> bb31; |
| - } |
| - |
| - bb28: { |
| - StorageDead(_20); |
| - StorageDead(_19); |
| - drop(_6) -> [return: bb29, unwind: bb53]; |
| - } |
| - |
| - bb29: { |
| - StorageDead(_6); |
| - goto -> bb30; |
| - } |
| - |
| - bb30: { |
| - StorageDead(_4); |
| - StorageDead(_3); |
| - goto -> bb31; |
| - } |
| - |
| - bb31: { |
| - drop(_1) -> [return: bb32, unwind: bb50]; |
| - } |
| - |
| - bb32: { |
| - coroutine_drop; |
| - } |
| - |
| - bb33 (cleanup): { |
| - StorageDead(_31); |
| - goto -> bb34; |
| - } |
| - |
| - bb34 (cleanup): { |
| + bb25 (cleanup): { |
| StorageDead(_29); |
| StorageDead(_26); |
| StorageDead(_30); |
| - goto -> bb36; |
| + goto -> bb27; |
| } |
| |
| - bb35 (cleanup): { |
| + bb26 (cleanup): { |
| StorageDead(_27); |
| StorageDead(_26); |
| - goto -> bb36; |
| + goto -> bb27; |
| } |
| |
| - bb36 (cleanup): { |
| + bb27 (cleanup): { |
| StorageDead(_28); |
| StorageDead(_25); |
| StorageDead(_24); |
| - drop(_23) -> [return: bb37, unwind terminate(cleanup)]; |
| + drop((((*_39) as variant#4).0: {async fn body of a()})) -> [return: bb28, unwind terminate(cleanup)]; |
| } |
| |
| - bb37 (cleanup): { |
| - StorageDead(_23); |
| - goto -> bb40; |
| + bb28 (cleanup): { |
| + nop; |
| + goto -> bb31; |
| } |
| |
| - bb38 (cleanup): { |
| - goto -> bb39; |
| + bb29 (cleanup): { |
| + goto -> bb30; |
| } |
| |
| - bb39 (cleanup): { |
| + bb30 (cleanup): { |
| StorageDead(_22); |
| - goto -> bb40; |
| + goto -> bb31; |
| } |
| |
| - bb40 (cleanup): { |
| + bb31 (cleanup): { |
| StorageDead(_21); |
| - goto -> bb49; |
| + goto -> bb39; |
| } |
| |
| - bb41 (cleanup): { |
| - StorageDead(_15); |
| - goto -> bb42; |
| - } |
| - |
| - bb42 (cleanup): { |
| + bb32 (cleanup): { |
| StorageDead(_13); |
| StorageDead(_10); |
| StorageDead(_14); |
| - goto -> bb44; |
| + goto -> bb34; |
| } |
| |
| - bb43 (cleanup): { |
| + bb33 (cleanup): { |
| StorageDead(_11); |
| StorageDead(_10); |
| - goto -> bb44; |
| + goto -> bb34; |
| } |
| |
| - bb44 (cleanup): { |
| + bb34 (cleanup): { |
| StorageDead(_12); |
| StorageDead(_9); |
| StorageDead(_8); |
| - drop(_6) -> [return: bb45, unwind terminate(cleanup)]; |
| + drop((((*_39) as variant#3).0: {async fn body of a()})) -> [return: bb35, unwind terminate(cleanup)]; |
| } |
| |
| - bb45 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb48; |
| + bb35 (cleanup): { |
| + nop; |
| + goto -> bb38; |
| } |
| |
| - bb46 (cleanup): { |
| - goto -> bb47; |
| + bb36 (cleanup): { |
| + goto -> bb37; |
| } |
| |
| - bb47 (cleanup): { |
| + bb37 (cleanup): { |
| StorageDead(_5); |
| - goto -> bb48; |
| + goto -> bb38; |
| } |
| |
| - bb48 (cleanup): { |
| + bb38 (cleanup): { |
| StorageDead(_4); |
| StorageDead(_3); |
| - goto -> bb49; |
| + goto -> bb39; |
| } |
| |
| - bb49 (cleanup): { |
| - drop(_1) -> [return: bb50, unwind terminate(cleanup)]; |
| + bb39 (cleanup): { |
| + goto -> bb40; |
| } |
| |
| - bb50 (cleanup): { |
| + bb40 (cleanup): { |
| + goto -> bb42; |
| + } |
| + |
| + bb41: { |
| + goto -> bb24; |
| + } |
| + |
| + bb42 (cleanup): { |
| + discriminant((*_39)) = 2; |
| resume; |
| } |
| |
| - bb51 (cleanup): { |
| - StorageDead(_23); |
| - goto -> bb52; |
| + bb43: { |
| + StorageLive(_3); |
| + StorageLive(_4); |
| + StorageLive(_19); |
| + StorageLive(_20); |
| + _19 = move _2; |
| + goto -> bb10; |
| } |
| |
| - bb52 (cleanup): { |
| - StorageDead(_21); |
| - goto -> bb55; |
| + bb44: { |
| + StorageLive(_21); |
| + StorageLive(_35); |
| + StorageLive(_36); |
| + _35 = move _2; |
| + goto -> bb21; |
| } |
| |
| - bb53 (cleanup): { |
| - StorageDead(_6); |
| - goto -> bb54; |
| + bb45: { |
| + assert(const false, "`async fn` resumed after panicking") -> [success: bb45, unwind continue]; |
| } |
| |
| - bb54 (cleanup): { |
| - StorageDead(_4); |
| - StorageDead(_3); |
| - goto -> bb55; |
| + bb46: { |
| + assert(const false, "`async fn` resumed after completion") -> [success: bb46, unwind continue]; |
| } |
| |
| - bb55 (cleanup): { |
| - drop(_1) -> [return: bb50, unwind terminate(cleanup)]; |
| + bb47: { |
| + StorageLive(_3); |
| + StorageLive(_4); |
| + StorageLive(_5); |
| + _5 = a() -> [return: bb1, unwind: bb37]; |
| } |
| } |
| |