From e9ff3ed778199e8575c09aa266cf973c4b3660f1 Mon Sep 17 00:00:00 2001 From: Camille Gillot Date: Sat, 6 Jun 2026 16:31:21 +0000 Subject: [PATCH 1/3] Remove uninit drops earlier. --- .../src/elaborate_drops.rs | 16 ++- compiler/rustc_mir_transform/src/lib.rs | 1 + .../src/remove_uninit_drops.rs | 3 +- .../basic_assignment.main.ElaborateDrops.diff | 18 +-- ...al_drop_allocator.main.ElaborateDrops.diff | 12 +- ...artial_move.maybe_move.ElaborateDrops.diff | 6 +- ...ible_struct_drop.build.ElaborateDrops.diff | 128 +++++------------- ...drop.array-{closure#0}.ElaborateDrops.diff | 15 +- ...rate_drops-{closure#0}.ElaborateDrops.diff | 66 +++------ ...anch_unwind.poll.EarlyOtherwiseBranch.diff | 48 +------ .../mir-opt/early_otherwise_branch_unwind.rs | 18 +-- ...ch_unwind.unwind.EarlyOtherwiseBranch.diff | 78 ++++++++--- ...41110.main.ElaborateDrops.panic-abort.diff | 6 +- ...1110.main.ElaborateDrops.panic-unwind.diff | 6 +- ...41110.test.ElaborateDrops.panic-abort.diff | 15 +- ...1110.test.ElaborateDrops.panic-unwind.diff | 15 +- ...41888.main.ElaborateDrops.panic-abort.diff | 9 +- ...1888.main.ElaborateDrops.panic-unwind.diff | 9 +- ...main.ElaborateDrops.before.panic-abort.mir | 2 +- ...ain.ElaborateDrops.before.panic-unwind.mir | 2 +- ...erwise_drops.result_ok.ElaborateDrops.diff | 18 +-- ....map.SimplifyLocals-before-const-prop.diff | 3 - ...ll_drops.f.ElaborateDrops.panic-abort.diff | 6 +- ...l_drops.f.ElaborateDrops.panic-unwind.diff | 6 +- ...f_with_arg.ElaborateDrops.panic-abort.diff | 12 +- ..._with_arg.ElaborateDrops.panic-unwind.diff | 12 +- ...hod_1.ElaborateDrops.after.panic-abort.mir | 4 - ...od_1.ElaborateDrops.after.panic-unwind.mir | 4 - 28 files changed, 201 insertions(+), 337 deletions(-) diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index 84c9c044ae6a6..27bf2162d8b34 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -3,6 +3,7 @@ use std::fmt; use rustc_abi::{FieldIdx, VariantIdx}; use rustc_index::IndexVec; use rustc_index::bit_set::DenseBitSet; +use rustc_middle::mir::traversal::reachable_as_bitset; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; @@ -58,6 +59,7 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateDrops { // For types that do not need dropping, the behaviour is trivial. So we only need to track // init/uninit for types that do need dropping. let move_data = MoveData::gather_moves(body, tcx, |ty| ty.needs_drop(tcx, typing_env)); + let reachable = reachable_as_bitset(body); let elaborate_patch = { let env = MoveDataTypingEnv { move_data, typing_env }; @@ -66,7 +68,7 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateDrops { .skipping_unreachable_unwind() .iterate_to_fixpoint(tcx, body, Some("elaborate_drops")) .into_results_cursor(body); - let dead_unwinds = compute_dead_unwinds(body, &mut inits); + let dead_unwinds = compute_dead_unwinds(body, &reachable, &mut inits); let uninits = MaybeUninitializedPlaces::new(tcx, body, &env.move_data) .mark_inactive_variants_as_uninit() @@ -79,6 +81,7 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateDrops { tcx, body, env: &env, + reachable: &reachable, init_data: InitializationData { inits, uninits }, drop_flags, patch: MirPatch::new(body), @@ -99,12 +102,14 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateDrops { #[instrument(level = "trace", skip(body, flow_inits), ret)] fn compute_dead_unwinds<'a, 'tcx>( body: &'a Body<'tcx>, + reachable: &DenseBitSet, flow_inits: &mut ResultsCursor<'a, 'tcx, MaybeInitializedPlaces<'a, 'tcx>>, ) -> DenseBitSet { // We only need to do this pass once, because unwind edges can only // reach cleanup blocks, which can't have unwind edges themselves. let mut dead_unwinds = DenseBitSet::new_empty(body.basic_blocks.len()); - for (bb, bb_data) in body.basic_blocks.iter_enumerated() { + for bb in reachable.iter() { + let bb_data = &body[bb]; let TerminatorKind::Drop { place, unwind: UnwindAction::Cleanup(_), .. } = bb_data.terminator().kind else { @@ -248,6 +253,7 @@ struct ElaborateDropsCtxt<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataTypingEnv<'tcx>, + reachable: &'a DenseBitSet, init_data: InitializationData<'a, 'tcx>, drop_flags: IndexVec>, patch: MirPatch<'tcx>, @@ -290,7 +296,8 @@ impl<'a, 'tcx> ElaborateDropsCtxt<'a, 'tcx> { } fn collect_drop_flags(&mut self) { - for (bb, data) in self.body.basic_blocks.iter_enumerated() { + for bb in self.reachable.iter() { + let data = &self.body[bb]; let terminator = data.terminator(); let TerminatorKind::Drop { ref place, .. } = terminator.kind else { continue }; @@ -337,7 +344,8 @@ impl<'a, 'tcx> ElaborateDropsCtxt<'a, 'tcx> { fn elaborate_drops(&mut self) { // This function should mirror what `collect_drop_flags` does. - for (bb, data) in self.body.basic_blocks.iter_enumerated() { + for bb in self.reachable.iter() { + let data = &self.body[bb]; let terminator = data.terminator(); let TerminatorKind::Drop { place, target, unwind, replace, drop } = terminator.kind else { diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index d2dd77c986318..e2f3be1aa5f7c 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -649,6 +649,7 @@ fn run_runtime_lowering_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &post_analysis_normalize::PostAnalysisNormalize, // Calling this after `PostAnalysisNormalize` ensures that we don't deal with opaque types. &add_subtyping_projections::Subtyper, + &remove_uninit_drops::RemoveUninitDrops, &elaborate_drops::ElaborateDrops, // Needs to happen after drop elaboration. &Lint(check_call_recursion::CheckDropRecursion), diff --git a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs index 19ac267b62836..dfc8f4dc48775 100644 --- a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs +++ b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs @@ -1,5 +1,6 @@ use rustc_abi::FieldIdx; use rustc_index::bit_set::MixedBitSet; +use rustc_middle::mir::traversal::reachable; use rustc_middle::mir::{Body, TerminatorKind}; use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, VariantDef}; use rustc_mir_dataflow::impls::MaybeInitializedPlaces; @@ -29,7 +30,7 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveUninitDrops { .into_results_cursor(body); let mut to_remove = vec![]; - for (bb, block) in body.basic_blocks.iter_enumerated() { + for (bb, block) in reachable(body) { let terminator = block.terminator(); let TerminatorKind::Drop { place, .. } = &terminator.kind else { continue }; diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff index 2d6adaca19e61..61a4a974f9815 100644 --- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -35,20 +35,17 @@ StorageLive(_5); StorageLive(_6); _6 = move _4; -- drop(_5) -> [return: bb1, unwind: bb2]; -+ goto -> bb1; + goto -> bb1; } bb1: { _5 = move _6; -- drop(_6) -> [return: bb3, unwind: bb6]; -+ goto -> bb3; + goto -> bb3; } bb2 (cleanup): { _5 = move _6; -- drop(_6) -> [return: bb6, unwind terminate(cleanup)]; -+ goto -> bb6; + goto -> bb6; } bb3: { @@ -59,8 +56,7 @@ bb4: { StorageDead(_5); -- drop(_4) -> [return: bb5, unwind continue]; -+ goto -> bb5; + goto -> bb5; } bb5: { @@ -71,13 +67,11 @@ } bb6 (cleanup): { -- drop(_5) -> [return: bb7, unwind terminate(cleanup)]; -+ goto -> bb7; + drop(_5) -> [return: bb7, unwind terminate(cleanup)]; } bb7 (cleanup): { -- drop(_4) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb8 (cleanup): { diff --git a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff index 6f6c239d7c831..c19294064861c 100644 --- a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff @@ -85,13 +85,11 @@ } bb8 (cleanup): { -- drop(_8) -> [return: bb10, unwind terminate(cleanup)]; -+ goto -> bb10; + goto -> bb10; } bb9 (cleanup): { -- drop(_6) -> [return: bb10, unwind terminate(cleanup)]; -+ goto -> bb10; + goto -> bb10; } bb10 (cleanup): { @@ -100,13 +98,11 @@ } bb11 (cleanup): { -- drop(_3) -> [return: bb12, unwind terminate(cleanup)]; -+ goto -> bb12; + goto -> bb12; } bb12 (cleanup): { -- drop(_2) -> [return: bb13, unwind terminate(cleanup)]; -+ goto -> bb13; + goto -> bb13; } bb13 (cleanup): { diff --git a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff index a22ea0b2c5789..807ee081afb75 100644 --- a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff +++ b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff @@ -27,8 +27,7 @@ + _5 = const false; _4 = move (*_2); _0 = Option::::Some(move _4); -- drop(_4) -> [return: bb2, unwind: bb6]; -+ goto -> bb2; + goto -> bb2; } bb2: { @@ -52,8 +51,7 @@ } bb6 (cleanup): { -- drop(_2) -> [return: bb7, unwind terminate(cleanup)]; -+ goto -> bb7; + drop(_2) -> [return: bb7, unwind terminate(cleanup)]; } bb7 (cleanup): { diff --git a/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff index b0db5ea383919..957214d6eebac 100644 --- a/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff +++ b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff @@ -55,10 +55,6 @@ let mut _50: !; let mut _51: std::result::Result; let _52: std::string::String; -+ let mut _53: bool; -+ let mut _54: bool; -+ let mut _55: bool; -+ let mut _56: bool; scope 1 { debug residual => _9; scope 2 { @@ -111,10 +107,6 @@ } bb0: { -+ _56 = const false; -+ _55 = const false; -+ _54 = const false; -+ _53 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); @@ -133,7 +125,6 @@ } bb2: { -+ _56 = const true; StorageDead(_5); PlaceMention(_4); _8 = discriminant(_4); @@ -148,8 +139,7 @@ StorageLive(_12); _12 = move ((_4 as Continue).0: std::string::String); _3 = move _12; -- drop(_12) -> [return: bb7, unwind: bb90]; -+ goto -> bb7; + goto -> bb7; } bb5: { @@ -187,7 +177,6 @@ } bb9: { -+ _55 = const true; StorageDead(_15); PlaceMention(_14); _18 = discriminant(_14); @@ -198,8 +187,7 @@ StorageLive(_22); _22 = move ((_14 as Continue).0: std::string::String); _13 = move _22; -- drop(_22) -> [return: bb13, unwind: bb86]; -+ goto -> bb13; + goto -> bb13; } bb11: { @@ -236,7 +224,6 @@ } bb15: { -+ _54 = const true; StorageDead(_25); PlaceMention(_24); _28 = discriminant(_24); @@ -247,8 +234,7 @@ StorageLive(_32); _32 = move ((_24 as Continue).0: std::string::String); _23 = move _32; -- drop(_32) -> [return: bb19, unwind: bb81]; -+ goto -> bb19; + goto -> bb19; } bb17: { @@ -285,7 +271,6 @@ } bb21: { -+ _53 = const true; StorageDead(_35); PlaceMention(_34); _38 = discriminant(_34); @@ -296,8 +281,7 @@ StorageLive(_42); _42 = move ((_34 as Continue).0: std::string::String); _33 = move _42; -- drop(_42) -> [return: bb25, unwind: bb75]; -+ goto -> bb25; + goto -> bb25; } bb23: { @@ -344,8 +328,7 @@ StorageLive(_52); _52 = move ((_44 as Continue).0: std::string::String); _43 = move _52; -- drop(_52) -> [return: bb31, unwind: bb68]; -+ goto -> bb31; + goto -> bb31; } bb29: { @@ -366,76 +349,61 @@ bb31: { StorageDead(_52); _2 = Big { f0: move _3, f1: move _13, f2: move _23, f3: move _33, f4: move _43 }; -- drop(_43) -> [return: bb32, unwind: bb63]; -+ goto -> bb32; + goto -> bb32; } bb32: { StorageDead(_43); -- drop(_33) -> [return: bb33, unwind: bb64]; -+ goto -> bb33; + goto -> bb33; } bb33: { StorageDead(_33); -- drop(_23) -> [return: bb34, unwind: bb65]; -+ goto -> bb34; + goto -> bb34; } bb34: { StorageDead(_23); -- drop(_13) -> [return: bb35, unwind: bb66]; -+ goto -> bb35; + goto -> bb35; } bb35: { StorageDead(_13); -- drop(_3) -> [return: bb36, unwind: bb67]; -+ goto -> bb36; + goto -> bb36; } bb36: { StorageDead(_3); _0 = Result::::Ok(move _2); -- drop(_2) -> [return: bb37, unwind: bb72]; -+ goto -> bb37; + goto -> bb37; } bb37: { StorageDead(_2); -- drop(_44) -> [return: bb38, unwind: bb78]; -+ goto -> bb38; + goto -> bb38; } bb38: { StorageDead(_44); -- drop(_34) -> [return: bb39, unwind: bb83]; -+ goto -> bb39; + goto -> bb39; } bb39: { -+ _53 = const false; StorageDead(_34); -- drop(_24) -> [return: bb40, unwind: bb87]; -+ goto -> bb40; + goto -> bb40; } bb40: { -+ _54 = const false; StorageDead(_24); -- drop(_14) -> [return: bb41, unwind: bb90]; -+ goto -> bb41; + goto -> bb41; } bb41: { -+ _55 = const false; StorageDead(_14); -- drop(_4) -> [return: bb42, unwind continue]; -+ goto -> bb42; + goto -> bb42; } bb42: { -+ _56 = const false; StorageDead(_4); goto -> bb62; } @@ -458,8 +426,7 @@ bb46: { StorageDead(_3); StorageDead(_2); -- drop(_44) -> [return: bb47, unwind: bb78]; -+ goto -> bb47; + goto -> bb47; } bb47: { @@ -484,12 +451,10 @@ } bb51: { -- drop(_34) -> [return: bb52, unwind: bb83]; -+ goto -> bb52; + goto -> bb52; } bb52: { -+ _53 = const false; StorageDead(_34); goto -> bb55; } @@ -506,12 +471,10 @@ } bb55: { -- drop(_24) -> [return: bb56, unwind: bb87]; -+ goto -> bb56; + goto -> bb56; } bb56: { -+ _54 = const false; StorageDead(_24); goto -> bb58; } @@ -523,23 +486,19 @@ } bb58: { -- drop(_14) -> [return: bb59, unwind: bb90]; -+ goto -> bb59; + goto -> bb59; } bb59: { -+ _55 = const false; StorageDead(_14); goto -> bb60; } bb60: { -- drop(_4) -> [return: bb61, unwind continue]; -+ goto -> bb61; + goto -> bb61; } bb61: { -+ _56 = const false; StorageDead(_4); goto -> bb62; } @@ -549,28 +508,23 @@ } bb63 (cleanup): { -- drop(_33) -> [return: bb64, unwind terminate(cleanup)]; -+ goto -> bb64; + goto -> bb64; } bb64 (cleanup): { -- drop(_23) -> [return: bb65, unwind terminate(cleanup)]; -+ goto -> bb65; + goto -> bb65; } bb65 (cleanup): { -- drop(_13) -> [return: bb66, unwind terminate(cleanup)]; -+ goto -> bb66; + goto -> bb66; } bb66 (cleanup): { -- drop(_3) -> [return: bb67, unwind terminate(cleanup)]; -+ goto -> bb67; + goto -> bb67; } bb67 (cleanup): { -- drop(_2) -> [return: bb72, unwind terminate(cleanup)]; -+ goto -> bb72; + drop(_2) -> [return: bb72, unwind terminate(cleanup)]; } bb68 (cleanup): { @@ -590,13 +544,11 @@ } bb72 (cleanup): { -- drop(_44) -> [return: bb78, unwind terminate(cleanup)]; -+ goto -> bb78; + goto -> bb78; } bb73 (cleanup): { -- drop(_45) -> [return: bb74, unwind terminate(cleanup)]; -+ goto -> bb74; + goto -> bb74; } bb74 (cleanup): { @@ -616,13 +568,11 @@ } bb78 (cleanup): { -- drop(_34) -> [return: bb83, unwind terminate(cleanup)]; -+ goto -> bb83; + goto -> bb83; } bb79 (cleanup): { -- drop(_35) -> [return: bb80, unwind terminate(cleanup)]; -+ goto -> bb80; + goto -> bb80; } bb80 (cleanup): { @@ -638,13 +588,11 @@ } bb83 (cleanup): { -- drop(_24) -> [return: bb87, unwind terminate(cleanup)]; -+ goto -> bb87; + goto -> bb87; } bb84 (cleanup): { -- drop(_25) -> [return: bb85, unwind terminate(cleanup)]; -+ goto -> bb85; + goto -> bb85; } bb85 (cleanup): { @@ -656,13 +604,11 @@ } bb87 (cleanup): { -- drop(_14) -> [return: bb90, unwind terminate(cleanup)]; -+ goto -> bb90; + goto -> bb90; } bb88 (cleanup): { -- drop(_15) -> [return: bb89, unwind terminate(cleanup)]; -+ goto -> bb89; + goto -> bb89; } bb89 (cleanup): { @@ -670,13 +616,11 @@ } bb90 (cleanup): { -- drop(_4) -> [return: bb92, unwind terminate(cleanup)]; -+ goto -> bb92; + goto -> bb92; } bb91 (cleanup): { -- drop(_5) -> [return: bb92, unwind terminate(cleanup)]; -+ goto -> bb92; + goto -> bb92; } bb92 (cleanup): { diff --git a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff index bad684407ae57..55d6ee5fcd4d7 100644 --- a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff +++ b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff @@ -37,14 +37,12 @@ StorageLive(_5); _5 = AsyncInt(const 2_i32); _3 = [move _4, move _5]; -- drop(_5) -> [return: bb1, unwind: bb9, drop: bb5]; -+ goto -> bb1; + goto -> bb1; } bb1: { StorageDead(_5); -- drop(_4) -> [return: bb2, unwind: bb10, drop: bb6]; -+ goto -> bb2; + goto -> bb2; } bb2: { @@ -66,8 +64,7 @@ bb5: { StorageDead(_5); -- drop(_4) -> [return: bb6, unwind: bb13]; -+ goto -> bb6; + drop(_4) -> [return: bb6, unwind: bb13]; } bb6: { @@ -87,8 +84,7 @@ bb9 (cleanup): { StorageDead(_5); -- drop(_4) -> [return: bb10, unwind terminate(cleanup)]; -+ goto -> bb10; + goto -> bb10; } bb10 (cleanup): { @@ -108,8 +104,7 @@ bb13 (cleanup): { StorageDead(_4); StorageDead(_3); -- drop(_1) -> [return: bb12, unwind terminate(cleanup)]; -+ goto -> bb12; + drop(_1) -> [return: bb12, unwind terminate(cleanup)]; + } + + bb14: { diff --git a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff index 4e0cbbfc4357c..a6adfd7ec228e 100644 --- a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff +++ b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff @@ -234,14 +234,12 @@ StorageLive(_7); _7 = AsyncInt(const 2_i32); _5 = [move _6, move _7]; -- drop(_7) -> [return: bb1, unwind: bb62, drop: bb38]; -+ goto -> bb1; + goto -> bb1; } bb1: { StorageDead(_7); -- drop(_6) -> [return: bb2, unwind: bb63, drop: bb39]; -+ goto -> bb2; + goto -> bb2; } bb2: { @@ -252,14 +250,12 @@ StorageLive(_10); _10 = AsyncInt(const 4_i32); _8 = AsyncStruct { i: const 3_i32, a: move _10, b: move _9 }; -- drop(_10) -> [return: bb3, unwind: bb59, drop: bb35]; -+ goto -> bb3; + goto -> bb3; } bb3: { StorageDead(_10); -- drop(_9) -> [return: bb4, unwind: bb60, drop: bb36]; -+ goto -> bb4; + goto -> bb4; } bb4: { @@ -272,20 +268,17 @@ StorageLive(_14); _14 = AsyncInt(const 9_i32); _11 = SyncThenAsync { i: const 6_i32, a: move _12, b: move _13, c: move _14 }; -- drop(_14) -> [return: bb5, unwind: bb55, drop: bb31]; -+ goto -> bb5; + goto -> bb5; } bb5: { StorageDead(_14); -- drop(_13) -> [return: bb6, unwind: bb56]; -+ goto -> bb6; + goto -> bb6; } bb6: { StorageDead(_13); -- drop(_12) -> [return: bb7, unwind: bb57, drop: bb33]; -+ goto -> bb7; + goto -> bb7; } bb7: { @@ -294,8 +287,7 @@ StorageLive(_16); _16 = AsyncInt(const 10_i32); _15 = AsyncEnum::A(move _16); -- drop(_16) -> [return: bb8, unwind: bb53, drop: bb29]; -+ goto -> bb8; + goto -> bb8; } bb8: { @@ -333,8 +325,7 @@ bb10: { StorageDead(_26); -- drop(_25) -> [return: bb11, unwind: bb45, drop: bb24]; -+ goto -> bb11; + goto -> bb11; } bb11: { @@ -345,8 +336,7 @@ bb12: { StorageDead(_24); -- drop(_23) -> [return: bb13, unwind: bb47, drop: bb26]; -+ goto -> bb13; + goto -> bb13; } bb13: { @@ -457,14 +447,12 @@ bb31: { StorageDead(_14); -- drop(_13) -> [return: bb32, unwind: bb74]; -+ goto -> bb32; + drop(_13) -> [return: bb32, unwind: bb74]; } bb32: { StorageDead(_13); -- drop(_12) -> [return: bb33, unwind: bb75]; -+ goto -> bb33; + drop(_12) -> [return: bb33, unwind: bb75]; } bb33: { @@ -480,8 +468,7 @@ bb35: { StorageDead(_10); -- drop(_9) -> [return: bb36, unwind: bb77]; -+ goto -> bb36; + drop(_9) -> [return: bb36, unwind: bb77]; } bb36: { @@ -497,8 +484,7 @@ bb38: { StorageDead(_7); -- drop(_6) -> [return: bb39, unwind: bb79]; -+ goto -> bb39; + drop(_6) -> [return: bb39, unwind: bb79]; } bb39: { @@ -530,8 +516,7 @@ bb44 (cleanup): { StorageDead(_26); -- drop(_25) -> [return: bb45, unwind terminate(cleanup)]; -+ goto -> bb45; + goto -> bb45; } bb45 (cleanup): { @@ -541,8 +526,7 @@ bb46 (cleanup): { StorageDead(_24); -- drop(_23) -> [return: bb47, unwind terminate(cleanup)]; -+ goto -> bb47; + goto -> bb47; } bb47 (cleanup): { @@ -561,8 +545,7 @@ } bb50 (cleanup): { -- drop(_18) -> [return: bb51, unwind terminate(cleanup)]; -+ goto -> bb51; + goto -> bb51; } bb51 (cleanup): { @@ -587,14 +570,12 @@ bb55 (cleanup): { StorageDead(_14); -- drop(_13) -> [return: bb56, unwind terminate(cleanup)]; -+ goto -> bb56; + goto -> bb56; } bb56 (cleanup): { StorageDead(_13); -- drop(_12) -> [return: bb57, unwind terminate(cleanup)]; -+ goto -> bb57; + goto -> bb57; } bb57 (cleanup): { @@ -609,8 +590,7 @@ bb59 (cleanup): { StorageDead(_10); -- drop(_9) -> [return: bb60, unwind terminate(cleanup)]; -+ goto -> bb60; + goto -> bb60; } bb60 (cleanup): { @@ -625,8 +605,7 @@ bb62 (cleanup): { StorageDead(_7); -- drop(_6) -> [return: bb63, unwind terminate(cleanup)]; -+ goto -> bb63; + goto -> bb63; } bb63 (cleanup): { @@ -692,8 +671,7 @@ bb74 (cleanup): { StorageDead(_13); -- drop(_12) -> [return: bb75, unwind terminate(cleanup)]; -+ goto -> bb75; + drop(_12) -> [return: bb75, unwind terminate(cleanup)]; } bb75 (cleanup): { diff --git a/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff index 94e773afa67b2..61c034f2ad2ac 100644 --- a/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff @@ -9,8 +9,6 @@ let mut _4: isize; let _5: std::vec::Vec; let _6: u8; - let mut _7: bool; - let mut _8: isize; scope 1 { debug _trailers => _5; } @@ -19,10 +17,8 @@ } bb0: { - _7 = const false; - _7 = const true; _4 = discriminant(_1); - switchInt(copy _4) -> [0: bb2, 1: bb4, otherwise: bb1]; + switchInt(move _4) -> [0: bb2, 1: bb4, otherwise: bb1]; } bb1: { @@ -31,7 +27,7 @@ bb2: { _3 = discriminant(((_1 as Ready).0: std::result::Result>, u8>)); - switchInt(copy _3) -> [0: bb3, 1: bb6, otherwise: bb1]; + switchInt(move _3) -> [0: bb3, 1: bb6, otherwise: bb1]; } bb3: { @@ -41,12 +37,12 @@ bb4: { _0 = const (); - goto -> bb15; + goto -> bb9; } bb5: { _0 = const (); - goto -> bb15; + goto -> bb9; } bb6: { @@ -54,19 +50,19 @@ _6 = copy ((((_1 as Ready).0: std::result::Result>, u8>) as Err).0: u8); _0 = const (); StorageDead(_6); - goto -> bb15; + goto -> bb9; } bb7: { StorageLive(_5); _5 = move ((((((_1 as Ready).0: std::result::Result>, u8>) as Ok).0: std::option::Option>) as Some).0: std::vec::Vec); _0 = const (); - drop(_5) -> [return: bb8, unwind: bb17]; + drop(_5) -> [return: bb8, unwind: bb10]; } bb8: { StorageDead(_5); - goto -> bb15; + goto -> bb9; } bb9: { @@ -76,35 +72,5 @@ bb10 (cleanup): { resume; } - - bb11: { - switchInt(copy _7) -> [0: bb12, otherwise: bb14]; - } - - bb12: { - _7 = const false; - goto -> bb9; - } - - bb13: { - goto -> bb12; - } - - bb14: { - _8 = discriminant(((_1 as Ready).0: std::result::Result>, u8>)); - switchInt(move _8) -> [0: bb13, otherwise: bb12]; - } - - bb15: { - switchInt(copy _4) -> [0: bb11, otherwise: bb9]; - } - - bb16 (cleanup): { - goto -> bb10; - } - - bb17 (cleanup): { - switchInt(copy _4) -> [0: bb16, otherwise: bb10]; - } } diff --git a/tests/mir-opt/early_otherwise_branch_unwind.rs b/tests/mir-opt/early_otherwise_branch_unwind.rs index cbccf11729ab3..c69e073917722 100644 --- a/tests/mir-opt/early_otherwise_branch_unwind.rs +++ b/tests/mir-opt/early_otherwise_branch_unwind.rs @@ -9,14 +9,14 @@ use std::task::Poll; // NB: This transform is not happening currently. // EMIT_MIR early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff -fn unwind(val: Option>>) { +pub fn unwind(val: Option>>) { // CHECK-LABEL: fn unwind( - // CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; - // CHECK: [[PARENT_UNWIND_BB]] (cleanup): { - // CHECK-NEXT: switchInt + // SHOULD-CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; + // SHOULD-CHECK: [[PARENT_UNWIND_BB]] (cleanup): { + // SHOULD-CHECK-NEXT: switchInt match val { - Some(Some(Some(_v))) => {} - Some(Some(None)) => {} + Some(Some(Ok(_v))) => {} + Some(Some(Err(_))) => {} Some(None) => {} None => {} } @@ -26,9 +26,9 @@ fn unwind(val: Option>>) { // EMIT_MIR early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff pub fn poll(val: Poll>, u8>>) { // CHECK-LABEL: fn poll( - // CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; - // CHECK: [[PARENT_UNWIND_BB]] (cleanup): { - // CHECK-NEXT: switchInt + // SHOULD-CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; + // SHOULD-CHECK: [[PARENT_UNWIND_BB]] (cleanup): { + // SHOULD-CHECK-NEXT: switchInt match val { Poll::Ready(Ok(Some(_trailers))) => {} Poll::Ready(Err(_err)) => {} diff --git a/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff index 321fcbf680385..fb938c508a3b8 100644 --- a/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff @@ -1,7 +1,7 @@ - // MIR for `unwind` before EarlyOtherwiseBranch + // MIR for `unwind` after EarlyOtherwiseBranch - fn unwind(_1: Option>>) -> () { + fn unwind(_1: Option>>) -> () { debug val => _1; let mut _0: (); let mut _2: isize; @@ -9,16 +9,24 @@ let mut _4: isize; let _5: T; let mut _6: bool; - let mut _7: isize; + let mut _7: bool; + let mut _8: isize; + let mut _9: isize; + let mut _10: isize; + let mut _11: isize; + let mut _12: isize; + let mut _13: isize; scope 1 { debug _v => _5; } bb0: { _6 = const false; + _7 = const false; _6 = const true; + _7 = const true; _4 = discriminant(_1); - switchInt(copy _4) -> [0: bb4, 1: bb2, otherwise: bb1]; + switchInt(move _4) -> [0: bb4, 1: bb2, otherwise: bb1]; } bb1: { @@ -26,40 +34,40 @@ } bb2: { - _3 = discriminant(((_1 as Some).0: std::option::Option>)); - switchInt(copy _3) -> [0: bb5, 1: bb3, otherwise: bb1]; + _3 = discriminant(((_1 as Some).0: std::option::Option>)); + switchInt(move _3) -> [0: bb5, 1: bb3, otherwise: bb1]; } bb3: { - _2 = discriminant(((((_1 as Some).0: std::option::Option>) as Some).0: std::option::Option)); - switchInt(move _2) -> [0: bb6, 1: bb7, otherwise: bb1]; + _2 = discriminant(((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result)); + switchInt(move _2) -> [0: bb7, 1: bb6, otherwise: bb1]; } bb4: { _0 = const (); - goto -> bb15; + goto -> bb18; } bb5: { _0 = const (); - goto -> bb15; + goto -> bb18; } bb6: { _0 = const (); - goto -> bb15; + goto -> bb18; } bb7: { StorageLive(_5); - _5 = move ((((((_1 as Some).0: std::option::Option>) as Some).0: std::option::Option) as Some).0: T); + _5 = move ((((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result) as Ok).0: T); _0 = const (); - drop(_5) -> [return: bb8, unwind: bb17]; + drop(_5) -> [return: bb8, unwind: bb22]; } bb8: { StorageDead(_5); - goto -> bb15; + goto -> bb18; } bb9: { @@ -71,7 +79,7 @@ } bb11: { - switchInt(copy _6) -> [0: bb12, otherwise: bb14]; + switchInt(copy _6) -> [0: bb12, otherwise: bb17]; } bb12: { @@ -80,24 +88,50 @@ } bb13: { - goto -> bb12; + switchInt(copy _7) -> [0: bb14, otherwise: bb16]; } bb14: { - _7 = discriminant(((_1 as Some).0: std::option::Option>)); - switchInt(move _7) -> [1: bb13, otherwise: bb12]; + _7 = const false; + goto -> bb12; } bb15: { - switchInt(copy _4) -> [1: bb11, otherwise: bb9]; + drop(((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result)) -> [return: bb14, unwind: bb10]; + } + + bb16: { + _8 = discriminant(((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result)); + switchInt(move _8) -> [0: bb14, otherwise: bb15]; + } + + bb17: { + _9 = discriminant(((_1 as Some).0: std::option::Option>)); + switchInt(move _9) -> [1: bb13, otherwise: bb12]; + } + + bb18: { + _10 = discriminant(_1); + switchInt(move _10) -> [1: bb11, otherwise: bb9]; + } + + bb19 (cleanup): { + _12 = discriminant(((_1 as Some).0: std::option::Option>)); + switchInt(move _12) -> [1: bb20, otherwise: bb10]; + } + + bb20 (cleanup): { + _11 = discriminant(((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result)); + switchInt(move _11) -> [0: bb10, otherwise: bb21]; } - bb16 (cleanup): { - goto -> bb10; + bb21 (cleanup): { + drop(((((_1 as Some).0: std::option::Option>) as Some).0: std::result::Result)) -> [return: bb10, unwind terminate(cleanup)]; } - bb17 (cleanup): { - switchInt(copy _4) -> [1: bb16, otherwise: bb10]; + bb22 (cleanup): { + _13 = discriminant(_1); + switchInt(move _13) -> [1: bb19, otherwise: bb10]; } } diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff index cf9522301281b..06f06fd072186 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff @@ -40,13 +40,11 @@ } bb3 (cleanup): { -- drop(_3) -> [return: bb5, unwind terminate(cleanup)]; -+ goto -> bb5; + goto -> bb5; } bb4 (cleanup): { -- drop(_4) -> [return: bb5, unwind terminate(cleanup)]; -+ goto -> bb5; + goto -> bb5; } bb5 (cleanup): { diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff index cf9522301281b..06f06fd072186 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff @@ -40,13 +40,11 @@ } bb3 (cleanup): { -- drop(_3) -> [return: bb5, unwind terminate(cleanup)]; -+ goto -> bb5; + goto -> bb5; } bb4 (cleanup): { -- drop(_4) -> [return: bb5, unwind terminate(cleanup)]; -+ goto -> bb5; + goto -> bb5; } bb5 (cleanup): { diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff index 15fd95a63fff0..9b295834964d1 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff @@ -35,20 +35,17 @@ StorageLive(_5); + _6 = const false; _5 = move _1; -- drop(_2) -> [return: bb2, unwind: bb3]; -+ goto -> bb2; + goto -> bb2; } bb2: { _2 = move _5; -- drop(_5) -> [return: bb4, unwind: bb8]; -+ goto -> bb4; + goto -> bb4; } bb3 (cleanup): { _2 = move _5; -- drop(_5) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb4: { @@ -59,8 +56,7 @@ bb5: { StorageDead(_2); -- drop(_1) -> [return: bb6, unwind: bb10]; -+ goto -> bb6; + goto -> bb6; } bb6: { @@ -70,8 +66,7 @@ } bb7 (cleanup): { -- drop(_4) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb8 (cleanup): { diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff index 4a0067981cb7a..9b295834964d1 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff @@ -35,20 +35,17 @@ StorageLive(_5); + _6 = const false; _5 = move _1; -- drop(_2) -> [return: bb2, unwind: bb3]; -+ goto -> bb2; + goto -> bb2; } bb2: { _2 = move _5; -- drop(_5) -> [return: bb4, unwind: bb8]; -+ goto -> bb4; + goto -> bb4; } bb3 (cleanup): { _2 = move _5; -- drop(_5) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb4: { @@ -59,8 +56,7 @@ bb5: { StorageDead(_2); -- drop(_1) -> [return: bb6, unwind continue]; -+ goto -> bb6; + goto -> bb6; } bb6: { @@ -70,8 +66,7 @@ } bb7 (cleanup): { -- drop(_4) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb8 (cleanup): { diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff index 67363aa7deca4..3cbcca7e16921 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff @@ -38,24 +38,21 @@ _4 = K; _3 = E::F(move _4); StorageDead(_4); -- drop(_1) -> [return: bb3, unwind: bb4]; -+ goto -> bb3; + goto -> bb3; } bb3: { + _7 = const true; + _8 = const true; _1 = move _3; -- drop(_3) -> [return: bb5, unwind: bb11]; -+ goto -> bb5; + goto -> bb5; } bb4 (cleanup): { + _7 = const true; + _8 = const true; _1 = move _3; -- drop(_3) -> [return: bb11, unwind terminate(cleanup)]; -+ goto -> bb11; + goto -> bb11; } bb5: { diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff index 15e16c563aec7..aacf1cafa67b9 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff @@ -38,24 +38,21 @@ _4 = K; _3 = E::F(move _4); StorageDead(_4); -- drop(_1) -> [return: bb3, unwind: bb4]; -+ goto -> bb3; + goto -> bb3; } bb3: { + _7 = const true; + _8 = const true; _1 = move _3; -- drop(_3) -> [return: bb5, unwind: bb11]; -+ goto -> bb5; + goto -> bb5; } bb4 (cleanup): { + _7 = const true; + _8 = const true; _1 = move _3; -- drop(_3) -> [return: bb11, unwind terminate(cleanup)]; -+ goto -> bb11; + goto -> bb11; } bb5: { diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir index 404de884ab562..98e359a7d80a8 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -31,7 +31,7 @@ fn main() -> () { } bb3 (cleanup): { - drop(_2) -> [return: bb4, unwind terminate(cleanup)]; + goto -> bb4; } bb4 (cleanup): { diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index 47a0878ffae1c..dc3ba1acc069a 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -31,7 +31,7 @@ fn main() -> () { } bb3 (cleanup): { - drop(_2) -> [return: bb4, unwind terminate(cleanup)]; + goto -> bb4; } bb4 (cleanup): { diff --git a/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff b/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff index d1f4298c86886..1b73781b0a18e 100644 --- a/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff +++ b/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff @@ -7,14 +7,11 @@ let mut _2: isize; let _3: std::string::String; let mut _4: std::string::String; -+ let mut _5: bool; scope 1 { debug s => _3; } bb0: { -+ _5 = const false; -+ _5 = const true; PlaceMention(_1); _2 = discriminant(_1); switchInt(move _2) -> [0: bb2, otherwise: bb1]; @@ -31,14 +28,12 @@ StorageLive(_4); _4 = move _3; _0 = Option::::Some(move _4); -- drop(_4) -> [return: bb3, unwind: bb7]; -+ goto -> bb3; + goto -> bb3; } bb3: { StorageDead(_4); -- drop(_3) -> [return: bb4, unwind: bb8]; -+ goto -> bb4; + goto -> bb4; } bb4: { @@ -47,8 +42,7 @@ } bb5: { -- drop(_1) -> [return: bb6, unwind: bb9]; -+ goto -> bb6; + goto -> bb6; } bb6: { @@ -56,13 +50,11 @@ } bb7 (cleanup): { -- drop(_3) -> [return: bb8, unwind terminate(cleanup)]; -+ goto -> bb8; + goto -> bb8; } bb8 (cleanup): { -- drop(_1) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb9; + goto -> bb9; } bb9 (cleanup): { diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff index 6c726ead3c806..630bc1e3b45a4 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff @@ -7,14 +7,11 @@ let mut _2: isize; let _3: std::boxed::Box<()>; let mut _4: std::boxed::Box<()>; -- let mut _5: bool; scope 1 { debug x => _3; } bb0: { -- _5 = const false; -- _5 = const true; _2 = discriminant(_1); switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff index 9a4f27a497d18..12739fcf3e651 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff @@ -59,8 +59,7 @@ bb5: { StorageDead(_5); -- drop(_4) -> [return: bb6, unwind: bb11]; -+ goto -> bb6; + goto -> bb6; } bb6: { @@ -75,8 +74,7 @@ } bb8 (cleanup): { -- drop(_7) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb9; + goto -> bb9; } bb9 (cleanup): { diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff index f13ee78aa368c..ab3fdc0235727 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff @@ -59,8 +59,7 @@ bb5: { StorageDead(_5); -- drop(_4) -> [return: bb6, unwind: bb11]; -+ goto -> bb6; + goto -> bb6; } bb6: { @@ -76,8 +75,7 @@ } bb8 (cleanup): { -- drop(_7) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb9; + goto -> bb9; } bb9 (cleanup): { diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff index 4fba0032729e6..fc5b71e3d1440 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff @@ -73,8 +73,7 @@ bb7: { StorageDead(_7); -- drop(_6) -> [return: bb8, unwind: bb18]; -+ goto -> bb8; + goto -> bb8; } bb8: { @@ -121,13 +120,11 @@ } bb18 (cleanup): { -- drop(_10) -> [return: bb19, unwind terminate(cleanup)]; -+ goto -> bb19; + drop(_10) -> [return: bb19, unwind terminate(cleanup)]; } bb19 (cleanup): { -- drop(_11) -> [return: bb26, unwind terminate(cleanup)]; -+ goto -> bb26; + drop(_11) -> [return: bb26, unwind terminate(cleanup)]; } bb20 (cleanup): { @@ -143,8 +140,7 @@ } bb23 (cleanup): { -- drop(_9) -> [return: bb24, unwind terminate(cleanup)]; -+ goto -> bb24; + goto -> bb24; } bb24 (cleanup): { diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff index 4fba0032729e6..fc5b71e3d1440 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff @@ -73,8 +73,7 @@ bb7: { StorageDead(_7); -- drop(_6) -> [return: bb8, unwind: bb18]; -+ goto -> bb8; + goto -> bb8; } bb8: { @@ -121,13 +120,11 @@ } bb18 (cleanup): { -- drop(_10) -> [return: bb19, unwind terminate(cleanup)]; -+ goto -> bb19; + drop(_10) -> [return: bb19, unwind terminate(cleanup)]; } bb19 (cleanup): { -- drop(_11) -> [return: bb26, unwind terminate(cleanup)]; -+ goto -> bb26; + drop(_11) -> [return: bb26, unwind terminate(cleanup)]; } bb20 (cleanup): { @@ -143,8 +140,7 @@ } bb23 (cleanup): { -- drop(_9) -> [return: bb24, unwind terminate(cleanup)]; -+ goto -> bb24; + goto -> bb24; } bb24 (cleanup): { diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir index 4e1a59cea791c..7a9762cf27f77 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir @@ -11,7 +11,6 @@ fn method_1(_1: Guard) -> () { let mut _7: isize; let _8: OtherDrop; let _9: (); - let mut _10: bool; scope 1 { debug other_drop => _8; } @@ -20,7 +19,6 @@ fn method_1(_1: Guard) -> () { } bb0: { - _10 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); @@ -38,7 +36,6 @@ fn method_1(_1: Guard) -> () { } bb2: { - _10 = const true; StorageDead(_3); PlaceMention(_2); _7 = discriminant(_2); @@ -80,7 +77,6 @@ fn method_1(_1: Guard) -> () { bb9: { StorageDead(_5); StorageDead(_4); - _10 = const false; StorageDead(_2); drop(_1) -> [return: bb10, unwind: bb14]; } diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir index 4e1a59cea791c..7a9762cf27f77 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir @@ -11,7 +11,6 @@ fn method_1(_1: Guard) -> () { let mut _7: isize; let _8: OtherDrop; let _9: (); - let mut _10: bool; scope 1 { debug other_drop => _8; } @@ -20,7 +19,6 @@ fn method_1(_1: Guard) -> () { } bb0: { - _10 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); @@ -38,7 +36,6 @@ fn method_1(_1: Guard) -> () { } bb2: { - _10 = const true; StorageDead(_3); PlaceMention(_2); _7 = discriminant(_2); @@ -80,7 +77,6 @@ fn method_1(_1: Guard) -> () { bb9: { StorageDead(_5); StorageDead(_4); - _10 = const false; StorageDead(_2); drop(_1) -> [return: bb10, unwind: bb14]; } From 9a6d973699cd32d61d5dd07d6478748e1b402557 Mon Sep 17 00:00:00 2001 From: Camille Gillot Date: Wed, 29 Jul 2026 18:33:43 +0000 Subject: [PATCH 2/3] Split critical unwind edges before borrowck. --- Cargo.lock | 1 + compiler/rustc_borrowck/Cargo.toml | 1 + compiler/rustc_borrowck/src/renumber.rs | 44 ++++++++++++++++++- ...egion_subtyping_basic.main.nll.0.32bit.mir | 26 ++++++++--- ...egion_subtyping_basic.main.nll.0.64bit.mir | 26 ++++++++--- 5 files changed, 82 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0addc566d6bdd..02debcf9b3948 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3764,6 +3764,7 @@ dependencies = [ "rustc_span", "rustc_trait_selection", "smallvec", + "thin-vec", "tracing", ] diff --git a/compiler/rustc_borrowck/Cargo.toml b/compiler/rustc_borrowck/Cargo.toml index a06386ec11de0..32e45834d62fe 100644 --- a/compiler/rustc_borrowck/Cargo.toml +++ b/compiler/rustc_borrowck/Cargo.toml @@ -23,5 +23,6 @@ rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } rustc_trait_selection = { path = "../rustc_trait_selection" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } +thin-vec = "0.2.18" tracing = "0.1" # tidy-alphabetical-end diff --git a/compiler/rustc_borrowck/src/renumber.rs b/compiler/rustc_borrowck/src/renumber.rs index d6dbc7dd831fb..3dd7c4771cf4e 100644 --- a/compiler/rustc_borrowck/src/renumber.rs +++ b/compiler/rustc_borrowck/src/renumber.rs @@ -1,9 +1,10 @@ -use rustc_index::IndexSlice; +use rustc_index::{IndexSlice, IndexVec}; use rustc_infer::infer::NllRegionVariableOrigin; use rustc_middle::mir::visit::{MutVisitor, TyContext}; -use rustc_middle::mir::{Body, ConstOperand, Location, Promoted}; +use rustc_middle::mir::*; use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeFoldable, fold_regions}; use rustc_span::Symbol; +use thin_vec::ThinVec; use tracing::{debug, instrument}; use crate::BorrowckInferCtxt; @@ -21,12 +22,51 @@ pub(crate) fn renumber_mir<'tcx>( let mut renumberer = RegionRenumberer { infcx }; for body in promoted.iter_mut() { + split_critical_unwind_edges(body); renumberer.visit_body_preserves_cfg(body); } + split_critical_unwind_edges(body); renumberer.visit_body_preserves_cfg(body); } +#[instrument(skip(body), level = "debug")] +fn split_critical_unwind_edges(body: &mut Body<'_>) { + let predecessors: IndexVec = + body.basic_blocks.predecessors().iter().map(|preds| preds.len()).collect(); + debug!(?predecessors); + + let mut new_blocks = vec![]; + for bb in predecessors.indices() { + let term = body.basic_blocks[bb].terminator(); + let Some(&UnwindAction::Cleanup(unwind)) = term.unwind() else { continue }; + if predecessors[unwind] <= 1 { + continue; + } + + debug!("{bb:?} has critical unwind edge: {unwind:?}"); + new_blocks.push((bb, unwind)); + } + + if new_blocks.is_empty() { + return; + } + + debug!(?new_blocks); + let basic_blocks = body.basic_blocks.as_mut(); + for (bb, target) in new_blocks { + let source_info = basic_blocks[bb].terminator().source_info; + let terminator = Terminator { + source_info, + kind: TerminatorKind::Goto { target }, + attributes: ThinVec::new(), + }; + let new_target = basic_blocks.push(BasicBlockData::new(Some(terminator), true)); + *basic_blocks[bb].terminator_mut().unwind_mut().unwrap() = + UnwindAction::Cleanup(new_target); + } +} + // The fields are used only for debugging output in `sccs_info`. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub(crate) enum RegionCtxt { diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index c069ce3fdf3cf..ea820b50cb785 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -5,15 +5,15 @@ | '?1 | Local | ['?1] | | Inferred Region Values -| '?0 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], '?0, '?1} -| '?1 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], '?1} +| '?0 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0], '?0, '?1} +| '?1 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0], '?1} | '?2 | U0 | {bb1[0..=8], bb2[0..=2]} | '?3 | U0 | {bb1[1..=8], bb2[0..=2]} | '?4 | U0 | {bb1[5..=8], bb2[0..=2]} | | Inference Constraints -| '?0 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0]} -| '?1 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0]} +| '?0 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0]} +| '?1 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0]} | '?2 live at {bb1[0]} | '?3 live at {bb1[1..=4]} | '?4 live at {bb1[5..=8], bb2[0..=2]} @@ -53,7 +53,7 @@ fn main() -> () { _3 = const ConstValue(Scalar(0x00000000): usize); FakeRead(ForIndex, _1); _4 = Lt(copy _3, const ValTree(Leaf(0x00000003): usize)); - assert(move _4, "index out of bounds: the length is {} but the index is {}", const ValTree(Leaf(0x00000003): usize), copy _3) -> [success: bb1, unwind: bb7]; + assert(move _4, "index out of bounds: the length is {} but the index is {}", const ValTree(Leaf(0x00000003): usize), copy _3) -> [success: bb1, unwind: bb8]; } bb1: { @@ -72,7 +72,7 @@ fn main() -> () { StorageLive(_7); StorageLive(_8); _8 = copy (*_5); - _7 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _8) -> [return: bb3, unwind: bb7]; + _7 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _8) -> [return: bb3, unwind: bb9]; } bb3: { @@ -84,7 +84,7 @@ fn main() -> () { bb4: { StorageLive(_9); - _9 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x00000016): usize)) -> [return: bb5, unwind: bb7]; + _9 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x00000016): usize)) -> [return: bb5, unwind: bb10]; } bb5: { @@ -104,4 +104,16 @@ fn main() -> () { bb7 (cleanup): { resume; } + + bb8 (cleanup): { + goto -> bb7; + } + + bb9 (cleanup): { + goto -> bb7; + } + + bb10 (cleanup): { + goto -> bb7; + } } diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index a866521e7c976..67c4eff7d0f72 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -5,15 +5,15 @@ | '?1 | Local | ['?1] | | Inferred Region Values -| '?0 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], '?0, '?1} -| '?1 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], '?1} +| '?0 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0], '?0, '?1} +| '?1 | U0 | {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0], '?1} | '?2 | U0 | {bb1[0..=8], bb2[0..=2]} | '?3 | U0 | {bb1[1..=8], bb2[0..=2]} | '?4 | U0 | {bb1[5..=8], bb2[0..=2]} | | Inference Constraints -| '?0 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0]} -| '?1 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0]} +| '?0 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0]} +| '?1 live at {bb0[0..=8], bb1[0..=8], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=4], bb7[0], bb8[0], bb9[0], bb10[0]} | '?2 live at {bb1[0]} | '?3 live at {bb1[1..=4]} | '?4 live at {bb1[5..=8], bb2[0..=2]} @@ -53,7 +53,7 @@ fn main() -> () { _3 = const ConstValue(Scalar(0x0000000000000000): usize); FakeRead(ForIndex, _1); _4 = Lt(copy _3, const ValTree(Leaf(0x0000000000000003): usize)); - assert(move _4, "index out of bounds: the length is {} but the index is {}", const ValTree(Leaf(0x0000000000000003): usize), copy _3) -> [success: bb1, unwind: bb7]; + assert(move _4, "index out of bounds: the length is {} but the index is {}", const ValTree(Leaf(0x0000000000000003): usize), copy _3) -> [success: bb1, unwind: bb8]; } bb1: { @@ -72,7 +72,7 @@ fn main() -> () { StorageLive(_7); StorageLive(_8); _8 = copy (*_5); - _7 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _8) -> [return: bb3, unwind: bb7]; + _7 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _8) -> [return: bb3, unwind: bb9]; } bb3: { @@ -84,7 +84,7 @@ fn main() -> () { bb4: { StorageLive(_9); - _9 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x0000000000000016): usize)) -> [return: bb5, unwind: bb7]; + _9 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x0000000000000016): usize)) -> [return: bb5, unwind: bb10]; } bb5: { @@ -104,4 +104,16 @@ fn main() -> () { bb7 (cleanup): { resume; } + + bb8 (cleanup): { + goto -> bb7; + } + + bb9 (cleanup): { + goto -> bb7; + } + + bb10 (cleanup): { + goto -> bb7; + } } From 53de6349dfd87bcf6ca3308e3ad4e205a495ff7a Mon Sep 17 00:00:00 2001 From: Camille Gillot Date: Thu, 18 Jun 2026 01:22:09 +0000 Subject: [PATCH 3/3] Remove uninit drops right after building MIR. --- compiler/rustc_mir_transform/src/lib.rs | 2 +- .../basic_assignment.main.ElaborateDrops.diff | 38 +- ...ignment.main.SimplifyCfg-initial.after.mir | 31 +- ...al_drop_allocator.main.ElaborateDrops.diff | 90 +- ...artial_move.maybe_move.ElaborateDrops.diff | 56 +- ...ible_struct_drop.build.ElaborateDrops.diff | 438 ++---- ..._by_subslice.CleanupPostBorrowck.after.mir | 30 +- ...out_from_end.CleanupPostBorrowck.after.mir | 30 +- ...move.box_new.CleanupPostBorrowck.after.mir | 24 +- ...ve.vec_macro.CleanupPostBorrowck.after.mir | 16 +- ...move.box_new.CleanupPostBorrowck.after.mir | 20 +- ...nc_await.b-{closure#0}.StateTransform.diff | 302 ++-- ...drop.array-{closure#0}.ElaborateDrops.diff | 142 +- ...drop.array-{closure#0}.StateTransform.diff | 167 +- ...rate_drops-{closure#0}.ElaborateDrops.diff | 1132 ++++++------- ...rate_drops-{closure#0}.StateTransform.diff | 1400 ++++++++--------- ...ync_fn.add-{closure#0}.StateTransform.diff | 162 +- ...nc_fn.add-{closure#0}.coroutine_drop.0.mir | 40 +- ..._aggregate-{closure#0}.StateTransform.diff | 284 ++-- ...aggregate-{closure#0}.coroutine_drop.0.mir | 64 +- ...ync_fn.foo-{closure#0}.StateTransform.diff | 134 +- ...nc_fn.foo-{closure#0}.coroutine_drop.0.mir | 32 +- ...ello_world-{closure#0}.StateTransform.diff | 253 ++- ...llo_world-{closure#0}.coroutine_drop.0.mir | 32 +- ...udes_never-{closure#0}.StateTransform.diff | 171 +- ...des_never-{closure#0}.coroutine_drop.0.mir | 32 +- ...rtial_init-{closure#0}.StateTransform.diff | 180 +-- ...tial_init-{closure#0}.coroutine_drop.0.mir | 38 +- ...ed_variant-{closure#0}.StateTransform.diff | 382 ++--- ...d_variant-{closure#0}.coroutine_drop.0.mir | 88 +- ...utine.main-{closure#0}.StateTransform.diff | 250 ++- ...utine.main-{closure#1}.StateTransform.diff | 250 ++- ...closure#0}.StateTransform.panic-abort.diff | 30 +- ...losure#0}.StateTransform.panic-unwind.diff | 98 +- ..._inline_test.main.Derefer.panic-abort.diff | 8 +- ...inline_test.main.Derefer.panic-unwind.diff | 10 +- ...anch_unwind.poll.EarlyOtherwiseBranch.diff | 36 +- ....unwrap_unchecked.Inline.panic-unwind.diff | 14 +- ...41110.main.ElaborateDrops.panic-abort.diff | 22 +- ...1110.main.ElaborateDrops.panic-unwind.diff | 22 +- ...41110.test.ElaborateDrops.panic-abort.diff | 49 +- ...1110.test.ElaborateDrops.panic-unwind.diff | 49 +- ...41888.main.ElaborateDrops.panic-abort.diff | 83 +- ...1888.main.ElaborateDrops.panic-unwind.diff | 83 +- ....test.ElaborateDrops.after.panic-abort.mir | 38 +- ...test.ElaborateDrops.after.panic-unwind.mir | 36 +- ...cs.forget.LowerIntrinsics.panic-abort.diff | 4 - ...s.forget.LowerIntrinsics.panic-unwind.diff | 4 - ...fg-initial.after-ElaborateDrops.after.diff | 48 +- ...fg-initial.after-ElaborateDrops.after.diff | 48 +- ...main.ElaborateDrops.before.panic-abort.mir | 6 +- ...ain.ElaborateDrops.before.panic-unwind.mir | 10 +- ...erwise_drops.result_ok.ElaborateDrops.diff | 30 +- ...mes.foo.ScalarReplacementOfAggregates.diff | 28 +- ...ropping.ScalarReplacementOfAggregates.diff | 12 +- ...ll_drops.f.ElaborateDrops.panic-abort.diff | 44 +- ...l_drops.f.ElaborateDrops.panic-unwind.diff | 44 +- ...f_with_arg.ElaborateDrops.panic-abort.diff | 84 +- ..._with_arg.ElaborateDrops.panic-unwind.diff | 84 +- ...hod_1.ElaborateDrops.after.panic-abort.mir | 20 +- ...od_1.ElaborateDrops.after.panic-unwind.mir | 20 +- ...y-borrowed-as-mutable-if-let-133941.stderr | 7 +- tests/ui/consts/const-eval/issue-65394.rs | 9 +- .../const-eval/issue-65394.stock.stderr | 16 - .../control-flow/drop-fail.precise.stderr | 2 +- tests/ui/consts/control-flow/drop-fail.rs | 2 - .../control-flow/drop-fail.stock.stderr | 15 +- tests/ui/consts/min_const_fn/min_const_fn.rs | 6 +- .../consts/min_const_fn/min_const_fn.stderr | 26 +- ...p-allow-const-fn-unstable.not_allow.stderr | 12 - .../precise-drop-allow-const-fn-unstable.rs | 3 +- .../drop-tracking-parent-expression.rs | 70 - .../drop-tracking-parent-expression.stderr | 128 -- tests/ui/coroutine/parent-expression.rs | 2 - tests/ui/coroutine/parent-expression.stderr | 60 +- .../drop/drop-order-comparisons.e2021.fixed | 2 - .../drop/drop-order-comparisons.e2021.stderr | 127 +- tests/ui/drop/drop-order-comparisons.rs | 2 - ...ail_expr_drop_order-on-coroutine-unwind.rs | 2 - ...expr_drop_order-on-coroutine-unwind.stderr | 57 +- .../drop-elaboration-after-borrowck-error.rs | 1 - ...op-elaboration-after-borrowck-error.stderr | 21 +- tests/ui/nll/ice-106874.rs | 2 - tests/ui/nll/ice-106874.stderr | 16 +- ...lized-drop-with-uninitialized-fragments.rs | 5 +- ...d-drop-with-uninitialized-fragments.stderr | 15 - .../ufcs-for-deref-inner-clone.stderr | 6 +- 87 files changed, 3258 insertions(+), 4730 deletions(-) delete mode 100644 tests/ui/consts/const-eval/issue-65394.stock.stderr delete mode 100644 tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr delete mode 100644 tests/ui/coroutine/drop-tracking-parent-expression.rs delete mode 100644 tests/ui/coroutine/drop-tracking-parent-expression.stderr delete mode 100644 tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index e2f3be1aa5f7c..bea7203b35643 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -412,6 +412,7 @@ fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal> { // This used to be part of MIR building, // now done separately to separate concerns. &lint_and_remove_uninhabited::LintAndRemoveUninhabited, + &remove_uninit_drops::RemoveUninitDrops, // MIR-level lints. &Lint(check_inline::CheckForceInline), &Lint(check_call_recursion::CheckCallRecursion), @@ -649,7 +650,6 @@ fn run_runtime_lowering_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &post_analysis_normalize::PostAnalysisNormalize, // Calling this after `PostAnalysisNormalize` ensures that we don't deal with opaque types. &add_subtyping_projections::Subtyper, - &remove_uninit_drops::RemoveUninitDrops, &elaborate_drops::ElaborateDrops, // Needs to happen after drop elaboration. &Lint(check_call_recursion::CheckDropRecursion), diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff index 61a4a974f9815..af6e70a0767b0 100644 --- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -35,47 +35,23 @@ StorageLive(_5); StorageLive(_6); _6 = move _4; - goto -> bb1; - } - - bb1: { _5 = move _6; - goto -> bb3; - } - - bb2 (cleanup): { - _5 = move _6; - goto -> bb6; - } - - bb3: { StorageDead(_6); _0 = const (); - drop(_5) -> [return: bb4, unwind: bb7]; +- drop(_5) -> [return: bb1, unwind continue]; ++ drop(_5) -> [return: bb1, unwind: bb2]; } - bb4: { + bb1: { StorageDead(_5); - goto -> bb5; - } - - bb5: { StorageDead(_4); StorageDead(_2); StorageDead(_1); return; - } - - bb6 (cleanup): { - drop(_5) -> [return: bb7, unwind terminate(cleanup)]; - } - - bb7 (cleanup): { - goto -> bb8; - } - - bb8 (cleanup): { - resume; ++ } ++ ++ bb2 (cleanup): { ++ resume; } } diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir index af4d568c7c768..e3efc51c50c09 100644 --- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir @@ -41,46 +41,21 @@ fn main() -> () { StorageLive(_5); StorageLive(_6); _6 = move _4; - drop(_5) -> [return: bb1, unwind: bb2]; - } - - bb1: { - _5 = move _6; - drop(_6) -> [return: bb3, unwind: bb6]; - } - - bb2 (cleanup): { _5 = move _6; - drop(_6) -> [return: bb6, unwind terminate(cleanup)]; - } - - bb3: { StorageDead(_6); _0 = const (); - drop(_5) -> [return: bb4, unwind: bb7]; + drop(_5) -> [return: bb1, unwind: bb2]; } - bb4: { + bb1: { StorageDead(_5); - drop(_4) -> [return: bb5, unwind: bb8]; - } - - bb5: { StorageDead(_4); StorageDead(_2); StorageDead(_1); return; } - bb6 (cleanup): { - drop(_5) -> [return: bb7, unwind terminate(cleanup)]; - } - - bb7 (cleanup): { - drop(_4) -> [return: bb8, unwind terminate(cleanup)]; - } - - bb8 (cleanup): { + bb2 (cleanup): { resume; } } diff --git a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff index c19294064861c..2f0b32176f9ea 100644 --- a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff @@ -31,11 +31,11 @@ _2 = HasDrop; StorageLive(_3); _3 = DropAllocator; - _1 = Box::::new_in(move _2, move _3) -> [return: bb1, unwind: bb11]; ++ _9 = const true; + _1 = Box::::new_in(move _2, move _3) -> [return: bb1, unwind continue]; } bb1: { -+ _9 = const true; StorageDead(_3); StorageDead(_2); StorageLive(_4); @@ -47,7 +47,7 @@ StorageLive(_5); StorageLive(_6); _6 = move (*_1); - _5 = std::mem::drop::(move _6) -> [return: bb3, unwind: bb9]; + _5 = std::mem::drop::(move _6) -> [return: bb3, unwind: bb8]; } bb3: { @@ -75,7 +75,7 @@ bb6: { StorageDead(_4); - drop(_1) -> [return: bb7, unwind continue]; -+ goto -> bb23; ++ goto -> bb19; } bb7: { @@ -85,98 +85,82 @@ } bb8 (cleanup): { - goto -> bb10; +- drop(_1) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb25; } bb9 (cleanup): { - goto -> bb10; - } - - bb10 (cleanup): { -- drop(_1) -> [return: bb13, unwind terminate(cleanup)]; -+ goto -> bb29; - } - - bb11 (cleanup): { - goto -> bb12; - } - - bb12 (cleanup): { - goto -> bb13; - } - - bb13 (cleanup): { resume; + } + -+ bb14: { ++ bb10: { + _9 = const false; + goto -> bb7; + } + -+ bb15 (cleanup): { -+ drop((_1.1: DropAllocator)) -> [return: bb13, unwind terminate(cleanup)]; ++ bb11 (cleanup): { ++ drop((_1.1: DropAllocator)) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb16 (cleanup): { -+ switchInt(copy _9) -> [0: bb13, otherwise: bb15]; ++ bb12 (cleanup): { ++ switchInt(copy _9) -> [0: bb9, otherwise: bb11]; + } + -+ bb17: { -+ drop((_1.1: DropAllocator)) -> [return: bb14, unwind: bb13]; ++ bb13: { ++ drop((_1.1: DropAllocator)) -> [return: bb10, unwind: bb9]; + } + -+ bb18: { -+ switchInt(copy _9) -> [0: bb14, otherwise: bb17]; ++ bb14: { ++ switchInt(copy _9) -> [0: bb10, otherwise: bb13]; + } + -+ bb19: { ++ bb15: { + _10 = &mut _1; -+ _11 = as Drop>::drop(move _10) -> [return: bb18, unwind: bb16]; ++ _11 = as Drop>::drop(move _10) -> [return: bb14, unwind: bb12]; + } + -+ bb20 (cleanup): { ++ bb16 (cleanup): { + _12 = &mut _1; -+ _13 = as Drop>::drop(move _12) -> [return: bb16, unwind terminate(cleanup)]; ++ _13 = as Drop>::drop(move _12) -> [return: bb12, unwind terminate(cleanup)]; + } + -+ bb21: { -+ goto -> bb19; ++ bb17: { ++ goto -> bb15; + } + -+ bb22: { ++ bb18: { + _14 = copy ((_1.0: std::ptr::Unique).0: std::ptr::NonNull) as *const HasDrop (Transmute); -+ goto -> bb21; ++ goto -> bb17; + } + -+ bb23: { -+ switchInt(copy _9) -> [0: bb18, otherwise: bb22]; ++ bb19: { ++ switchInt(copy _9) -> [0: bb14, otherwise: bb18]; + } + -+ bb24 (cleanup): { -+ drop((_1.1: DropAllocator)) -> [return: bb13, unwind terminate(cleanup)]; ++ bb20 (cleanup): { ++ drop((_1.1: DropAllocator)) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb25 (cleanup): { -+ switchInt(copy _9) -> [0: bb13, otherwise: bb24]; ++ bb21 (cleanup): { ++ switchInt(copy _9) -> [0: bb9, otherwise: bb20]; + } + -+ bb26 (cleanup): { ++ bb22 (cleanup): { + _15 = &mut _1; -+ _16 = as Drop>::drop(move _15) -> [return: bb25, unwind terminate(cleanup)]; ++ _16 = as Drop>::drop(move _15) -> [return: bb21, unwind terminate(cleanup)]; + } + -+ bb27 (cleanup): { -+ goto -> bb26; ++ bb23 (cleanup): { ++ goto -> bb22; + } + -+ bb28 (cleanup): { ++ bb24 (cleanup): { + _17 = copy ((_1.0: std::ptr::Unique).0: std::ptr::NonNull) as *const HasDrop (Transmute); -+ goto -> bb27; ++ goto -> bb23; + } + -+ bb29 (cleanup): { -+ switchInt(copy _9) -> [0: bb25, otherwise: bb28]; ++ bb25 (cleanup): { ++ switchInt(copy _9) -> [0: bb21, otherwise: bb24]; } } diff --git a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff index 807ee081afb75..19d498fab5ba5 100644 --- a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff +++ b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff @@ -19,7 +19,7 @@ + _5 = const true; StorageLive(_3); _3 = copy _1; - switchInt(move _3) -> [0: bb3, otherwise: bb1]; + switchInt(move _3) -> [0: bb2, otherwise: bb1]; } bb1: { @@ -27,62 +27,54 @@ + _5 = const false; _4 = move (*_2); _0 = Option::::Some(move _4); - goto -> bb2; - } - - bb2: { StorageDead(_4); - goto -> bb4; + goto -> bb3; } - bb3: { + bb2: { _0 = Option::::None; - goto -> bb4; + goto -> bb3; } - bb4: { + bb3: { StorageDead(_3); -- drop(_2) -> [return: bb5, unwind continue]; -+ goto -> bb13; +- drop(_2) -> [return: bb4, unwind continue]; ++ goto -> bb11; } - bb5: { + bb4: { return; - } - - bb6 (cleanup): { - drop(_2) -> [return: bb7, unwind terminate(cleanup)]; - } - - bb7 (cleanup): { - resume; + } + -+ bb8: { ++ bb5 (cleanup): { ++ resume; ++ } ++ ++ bb6: { + _6 = &mut _2; -+ _7 = as Drop>::drop(move _6) -> [return: bb5, unwind: bb7]; ++ _7 = as Drop>::drop(move _6) -> [return: bb4, unwind: bb5]; + } + -+ bb9 (cleanup): { ++ bb7 (cleanup): { + _8 = &mut _2; -+ _9 = as Drop>::drop(move _8) -> [return: bb7, unwind terminate(cleanup)]; ++ _9 = as Drop>::drop(move _8) -> [return: bb5, unwind terminate(cleanup)]; + } + -+ bb10: { -+ goto -> bb12; ++ bb8: { ++ goto -> bb10; + } + -+ bb11: { -+ drop((*_10)) -> [return: bb8, unwind: bb9]; ++ bb9: { ++ drop((*_10)) -> [return: bb6, unwind: bb7]; + } + -+ bb12: { -+ switchInt(copy _5) -> [0: bb8, otherwise: bb11]; ++ bb10: { ++ switchInt(copy _5) -> [0: bb6, otherwise: bb9]; + } + -+ bb13: { ++ bb11: { + _10 = copy ((_2.0: std::ptr::Unique).0: std::ptr::NonNull) as *const std::string::String (Transmute); -+ goto -> bb10; ++ goto -> bb8; } } diff --git a/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff index 957214d6eebac..f10b7e6af9c86 100644 --- a/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff +++ b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff @@ -121,7 +121,7 @@ bb1: { StorageDead(_6); - _4 = as Try>::branch(move _5) -> [return: bb2, unwind: bb91]; + _4 = as Try>::branch(move _5) -> [return: bb2, unwind continue]; } bb2: { @@ -139,7 +139,16 @@ StorageLive(_12); _12 = move ((_4 as Continue).0: std::string::String); _3 = move _12; - goto -> bb7; + StorageDead(_12); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); + StorageLive(_16); + StorageLive(_17); + _17 = copy _1; + _16 = BitXor(move _17, const 1_u64); + StorageDead(_17); + _15 = make_one(move _16) -> [return: bb7, unwind: bb55]; } bb5: { @@ -147,7 +156,7 @@ _9 = copy ((_4 as Break).0: std::result::Result); StorageLive(_11); _11 = copy _9; - _0 = as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb90]; + _0 = as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind continue]; } bb6: { @@ -155,475 +164,326 @@ StorageDead(_9); StorageDead(_3); StorageDead(_2); - goto -> bb60; + goto -> bb40; } bb7: { - StorageDead(_12); - StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - StorageLive(_16); - StorageLive(_17); - _17 = copy _1; - _16 = BitXor(move _17, const 1_u64); - StorageDead(_17); - _15 = make_one(move _16) -> [return: bb8, unwind: bb89]; - } - - bb8: { StorageDead(_16); - _14 = as Try>::branch(move _15) -> [return: bb9, unwind: bb88]; + _14 = as Try>::branch(move _15) -> [return: bb8, unwind: bb55]; } - bb9: { + bb8: { StorageDead(_15); PlaceMention(_14); _18 = discriminant(_14); - switchInt(move _18) -> [0: bb10, 1: bb11, otherwise: bb3]; + switchInt(move _18) -> [0: bb9, 1: bb10, otherwise: bb3]; } - bb10: { + bb9: { StorageLive(_22); _22 = move ((_14 as Continue).0: std::string::String); _13 = move _22; - goto -> bb13; + StorageDead(_22); + StorageLive(_23); + StorageLive(_24); + StorageLive(_25); + StorageLive(_26); + StorageLive(_27); + _27 = copy _1; + _26 = BitXor(move _27, const 2_u64); + StorageDead(_27); + _25 = make_one(move _26) -> [return: bb12, unwind: bb53]; } - bb11: { + bb10: { StorageLive(_19); _19 = copy ((_14 as Break).0: std::result::Result); StorageLive(_21); _21 = copy _19; - _0 = as FromResidual>>::from_residual(move _21) -> [return: bb12, unwind: bb86]; + _0 = as FromResidual>>::from_residual(move _21) -> [return: bb11, unwind: bb54]; } - bb12: { + bb11: { StorageDead(_21); StorageDead(_19); StorageDead(_13); - drop(_3) -> [return: bb57, unwind: bb87]; - } - - bb13: { - StorageDead(_22); - StorageLive(_23); - StorageLive(_24); - StorageLive(_25); - StorageLive(_26); - StorageLive(_27); - _27 = copy _1; - _26 = BitXor(move _27, const 2_u64); - StorageDead(_27); - _25 = make_one(move _26) -> [return: bb14, unwind: bb85]; +- drop(_3) -> [return: bb38, unwind continue]; ++ drop(_3) -> [return: bb38, unwind: bb56]; } - bb14: { + bb12: { StorageDead(_26); - _24 = as Try>::branch(move _25) -> [return: bb15, unwind: bb84]; + _24 = as Try>::branch(move _25) -> [return: bb13, unwind: bb53]; } - bb15: { + bb13: { StorageDead(_25); PlaceMention(_24); _28 = discriminant(_24); - switchInt(move _28) -> [0: bb16, 1: bb17, otherwise: bb3]; + switchInt(move _28) -> [0: bb14, 1: bb15, otherwise: bb3]; } - bb16: { + bb14: { StorageLive(_32); _32 = move ((_24 as Continue).0: std::string::String); _23 = move _32; - goto -> bb19; + StorageDead(_32); + StorageLive(_33); + StorageLive(_34); + StorageLive(_35); + StorageLive(_36); + StorageLive(_37); + _37 = copy _1; + _36 = BitXor(move _37, const 3_u64); + StorageDead(_37); + _35 = make_one(move _36) -> [return: bb17, unwind: bb50]; } - bb17: { + bb15: { StorageLive(_29); _29 = copy ((_24 as Break).0: std::result::Result); StorageLive(_31); _31 = copy _29; - _0 = as FromResidual>>::from_residual(move _31) -> [return: bb18, unwind: bb81]; + _0 = as FromResidual>>::from_residual(move _31) -> [return: bb16, unwind: bb51]; } - bb18: { + bb16: { StorageDead(_31); StorageDead(_29); StorageDead(_23); - drop(_13) -> [return: bb53, unwind: bb82]; + drop(_13) -> [return: bb35, unwind: bb52]; } - bb19: { - StorageDead(_32); - StorageLive(_33); - StorageLive(_34); - StorageLive(_35); - StorageLive(_36); - StorageLive(_37); - _37 = copy _1; - _36 = BitXor(move _37, const 3_u64); - StorageDead(_37); - _35 = make_one(move _36) -> [return: bb20, unwind: bb80]; - } - - bb20: { + bb17: { StorageDead(_36); - _34 = as Try>::branch(move _35) -> [return: bb21, unwind: bb79]; + _34 = as Try>::branch(move _35) -> [return: bb18, unwind: bb50]; } - bb21: { + bb18: { StorageDead(_35); PlaceMention(_34); _38 = discriminant(_34); - switchInt(move _38) -> [0: bb22, 1: bb23, otherwise: bb3]; + switchInt(move _38) -> [0: bb19, 1: bb20, otherwise: bb3]; } - bb22: { + bb19: { StorageLive(_42); _42 = move ((_34 as Continue).0: std::string::String); _33 = move _42; - goto -> bb25; + StorageDead(_42); + StorageLive(_43); + StorageLive(_44); + StorageLive(_45); + StorageLive(_46); + StorageLive(_47); + _47 = copy _1; + _46 = BitXor(move _47, const 4_u64); + StorageDead(_47); + _45 = make_one(move _46) -> [return: bb22, unwind: bb46]; } - bb23: { + bb20: { StorageLive(_39); _39 = copy ((_34 as Break).0: std::result::Result); StorageLive(_41); _41 = copy _39; - _0 = as FromResidual>>::from_residual(move _41) -> [return: bb24, unwind: bb75]; + _0 = as FromResidual>>::from_residual(move _41) -> [return: bb21, unwind: bb47]; } - bb24: { + bb21: { StorageDead(_41); StorageDead(_39); StorageDead(_33); - drop(_23) -> [return: bb48, unwind: bb76]; - } - - bb25: { - StorageDead(_42); - StorageLive(_43); - StorageLive(_44); - StorageLive(_45); - StorageLive(_46); - StorageLive(_47); - _47 = copy _1; - _46 = BitXor(move _47, const 4_u64); - StorageDead(_47); - _45 = make_one(move _46) -> [return: bb26, unwind: bb74]; + drop(_23) -> [return: bb31, unwind: bb48]; } - bb26: { + bb22: { StorageDead(_46); - _44 = as Try>::branch(move _45) -> [return: bb27, unwind: bb73]; + _44 = as Try>::branch(move _45) -> [return: bb23, unwind: bb46]; } - bb27: { + bb23: { StorageDead(_45); PlaceMention(_44); _48 = discriminant(_44); - switchInt(move _48) -> [0: bb28, 1: bb29, otherwise: bb3]; + switchInt(move _48) -> [0: bb24, 1: bb25, otherwise: bb3]; } - bb28: { + bb24: { StorageLive(_52); _52 = move ((_44 as Continue).0: std::string::String); _43 = move _52; - goto -> bb31; - } - - bb29: { - StorageLive(_49); - _49 = copy ((_44 as Break).0: std::result::Result); - StorageLive(_51); - _51 = copy _49; - _0 = as FromResidual>>::from_residual(move _51) -> [return: bb30, unwind: bb68]; - } - - bb30: { - StorageDead(_51); - StorageDead(_49); - StorageDead(_43); - drop(_33) -> [return: bb43, unwind: bb69]; - } - - bb31: { StorageDead(_52); _2 = Big { f0: move _3, f1: move _13, f2: move _23, f3: move _33, f4: move _43 }; - goto -> bb32; - } - - bb32: { StorageDead(_43); - goto -> bb33; - } - - bb33: { StorageDead(_33); - goto -> bb34; - } - - bb34: { StorageDead(_23); - goto -> bb35; - } - - bb35: { StorageDead(_13); - goto -> bb36; - } - - bb36: { StorageDead(_3); _0 = Result::::Ok(move _2); - goto -> bb37; - } - - bb37: { StorageDead(_2); - goto -> bb38; - } - - bb38: { StorageDead(_44); - goto -> bb39; - } - - bb39: { StorageDead(_34); - goto -> bb40; - } - - bb40: { StorageDead(_24); + StorageDead(_14); + StorageDead(_4); goto -> bb41; } - bb41: { - StorageDead(_14); - goto -> bb42; + bb25: { + StorageLive(_49); + _49 = copy ((_44 as Break).0: std::result::Result); + StorageLive(_51); + _51 = copy _49; + _0 = as FromResidual>>::from_residual(move _51) -> [return: bb26, unwind: bb42]; } - bb42: { - StorageDead(_4); - goto -> bb62; + bb26: { + StorageDead(_51); + StorageDead(_49); + StorageDead(_43); + drop(_33) -> [return: bb27, unwind: bb43]; } - bb43: { + bb27: { StorageDead(_33); - drop(_23) -> [return: bb44, unwind: bb70]; + drop(_23) -> [return: bb28, unwind: bb44]; } - bb44: { + bb28: { StorageDead(_23); - drop(_13) -> [return: bb45, unwind: bb71]; + drop(_13) -> [return: bb29, unwind: bb45]; } - bb45: { + bb29: { StorageDead(_13); - drop(_3) -> [return: bb46, unwind: bb72]; +- drop(_3) -> [return: bb30, unwind continue]; ++ drop(_3) -> [return: bb30, unwind: bb56]; } - bb46: { + bb30: { StorageDead(_3); StorageDead(_2); - goto -> bb47; - } - - bb47: { StorageDead(_44); - goto -> bb51; + goto -> bb34; } - bb48: { + bb31: { StorageDead(_23); - drop(_13) -> [return: bb49, unwind: bb77]; + drop(_13) -> [return: bb32, unwind: bb49]; } - bb49: { + bb32: { StorageDead(_13); - drop(_3) -> [return: bb50, unwind: bb78]; +- drop(_3) -> [return: bb33, unwind continue]; ++ drop(_3) -> [return: bb33, unwind: bb56]; } - bb50: { + bb33: { StorageDead(_3); StorageDead(_2); - goto -> bb51; - } - - bb51: { - goto -> bb52; + goto -> bb34; } - bb52: { + bb34: { StorageDead(_34); - goto -> bb55; + goto -> bb37; } - bb53: { + bb35: { StorageDead(_13); - drop(_3) -> [return: bb54, unwind: bb83]; +- drop(_3) -> [return: bb36, unwind continue]; ++ drop(_3) -> [return: bb36, unwind: bb56]; } - bb54: { + bb36: { StorageDead(_3); StorageDead(_2); - goto -> bb55; - } - - bb55: { - goto -> bb56; + goto -> bb37; } - bb56: { + bb37: { StorageDead(_24); - goto -> bb58; + goto -> bb39; } - bb57: { + bb38: { StorageDead(_3); StorageDead(_2); - goto -> bb58; - } - - bb58: { - goto -> bb59; + goto -> bb39; } - bb59: { + bb39: { StorageDead(_14); - goto -> bb60; - } - - bb60: { - goto -> bb61; + goto -> bb40; } - bb61: { + bb40: { StorageDead(_4); - goto -> bb62; + goto -> bb41; } - bb62: { + bb41: { return; } - bb63 (cleanup): { - goto -> bb64; - } - - bb64 (cleanup): { - goto -> bb65; - } - - bb65 (cleanup): { - goto -> bb66; - } - - bb66 (cleanup): { - goto -> bb67; - } - - bb67 (cleanup): { - drop(_2) -> [return: bb72, unwind terminate(cleanup)]; - } - - bb68 (cleanup): { - drop(_33) -> [return: bb69, unwind terminate(cleanup)]; - } - - bb69 (cleanup): { - drop(_23) -> [return: bb70, unwind terminate(cleanup)]; - } - - bb70 (cleanup): { - drop(_13) -> [return: bb71, unwind terminate(cleanup)]; - } - - bb71 (cleanup): { - drop(_3) -> [return: bb72, unwind terminate(cleanup)]; - } - - bb72 (cleanup): { - goto -> bb78; - } - - bb73 (cleanup): { - goto -> bb74; - } - - bb74 (cleanup): { - drop(_33) -> [return: bb75, unwind terminate(cleanup)]; - } - - bb75 (cleanup): { - drop(_23) -> [return: bb76, unwind terminate(cleanup)]; - } - - bb76 (cleanup): { - drop(_13) -> [return: bb77, unwind terminate(cleanup)]; - } - - bb77 (cleanup): { - drop(_3) -> [return: bb78, unwind terminate(cleanup)]; - } - - bb78 (cleanup): { - goto -> bb83; + bb42 (cleanup): { + drop(_33) -> [return: bb43, unwind terminate(cleanup)]; } - bb79 (cleanup): { - goto -> bb80; + bb43 (cleanup): { + drop(_23) -> [return: bb44, unwind terminate(cleanup)]; } - bb80 (cleanup): { - drop(_23) -> [return: bb81, unwind terminate(cleanup)]; + bb44 (cleanup): { + drop(_13) -> [return: bb45, unwind terminate(cleanup)]; } - bb81 (cleanup): { - drop(_13) -> [return: bb82, unwind terminate(cleanup)]; + bb45 (cleanup): { + drop(_3) -> [return: bb56, unwind terminate(cleanup)]; } - bb82 (cleanup): { - drop(_3) -> [return: bb83, unwind terminate(cleanup)]; + bb46 (cleanup): { + drop(_33) -> [return: bb47, unwind terminate(cleanup)]; } - bb83 (cleanup): { - goto -> bb87; + bb47 (cleanup): { + drop(_23) -> [return: bb48, unwind terminate(cleanup)]; } - bb84 (cleanup): { - goto -> bb85; + bb48 (cleanup): { + drop(_13) -> [return: bb49, unwind terminate(cleanup)]; } - bb85 (cleanup): { - drop(_13) -> [return: bb86, unwind terminate(cleanup)]; + bb49 (cleanup): { + drop(_3) -> [return: bb56, unwind terminate(cleanup)]; } - bb86 (cleanup): { - drop(_3) -> [return: bb87, unwind terminate(cleanup)]; + bb50 (cleanup): { + drop(_23) -> [return: bb51, unwind terminate(cleanup)]; } - bb87 (cleanup): { - goto -> bb90; + bb51 (cleanup): { + drop(_13) -> [return: bb52, unwind terminate(cleanup)]; } - bb88 (cleanup): { - goto -> bb89; + bb52 (cleanup): { + drop(_3) -> [return: bb56, unwind terminate(cleanup)]; } - bb89 (cleanup): { - drop(_3) -> [return: bb90, unwind terminate(cleanup)]; + bb53 (cleanup): { + drop(_13) -> [return: bb54, unwind terminate(cleanup)]; } - bb90 (cleanup): { - goto -> bb92; + bb54 (cleanup): { + drop(_3) -> [return: bb56, unwind terminate(cleanup)]; } - bb91 (cleanup): { - goto -> bb92; + bb55 (cleanup): { + drop(_3) -> [return: bb56, unwind terminate(cleanup)]; } - bb92 (cleanup): { + bb56 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.CleanupPostBorrowck.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.CleanupPostBorrowck.after.mir index 17756938b889d..1ae0e19d94d79 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.CleanupPostBorrowck.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.CleanupPostBorrowck.after.mir @@ -16,53 +16,45 @@ fn move_out_by_subslice() -> () { bb0: { StorageLive(_1); StorageLive(_2); - _2 = Box::::new(const 1_i32) -> [return: bb1, unwind: bb9]; + _2 = Box::::new(const 1_i32) -> [return: bb1, unwind: bb7]; } bb1: { StorageLive(_3); - _3 = Box::::new(const 2_i32) -> [return: bb2, unwind: bb8]; + _3 = Box::::new(const 2_i32) -> [return: bb2, unwind: bb6]; } bb2: { _1 = [move _2, move _3]; - drop(_3) -> [return: bb3, unwind: bb8]; - } - - bb3: { StorageDead(_3); - drop(_2) -> [return: bb4, unwind: bb9]; - } - - bb4: { StorageDead(_2); nop; PlaceMention(_1); StorageLive(_4); _4 = move _1[0..2]; _0 = const (); - drop(_4) -> [return: bb5, unwind: bb7]; + drop(_4) -> [return: bb3, unwind: bb5]; } - bb5: { + bb3: { StorageDead(_4); - drop(_1) -> [return: bb6, unwind: bb9]; + drop(_1) -> [return: bb4, unwind: bb7]; } - bb6: { + bb4: { StorageDead(_1); return; } - bb7 (cleanup): { - drop(_1) -> [return: bb9, unwind terminate(cleanup)]; + bb5 (cleanup): { + drop(_1) -> [return: bb7, unwind terminate(cleanup)]; } - bb8 (cleanup): { - drop(_2) -> [return: bb9, unwind terminate(cleanup)]; + bb6 (cleanup): { + drop(_2) -> [return: bb7, unwind terminate(cleanup)]; } - bb9 (cleanup): { + bb7 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.CleanupPostBorrowck.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.CleanupPostBorrowck.after.mir index 79e0f0af0dbc8..8c082ce6bf11c 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.CleanupPostBorrowck.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.CleanupPostBorrowck.after.mir @@ -16,53 +16,45 @@ fn move_out_from_end() -> () { bb0: { StorageLive(_1); StorageLive(_2); - _2 = Box::::new(const 1_i32) -> [return: bb1, unwind: bb9]; + _2 = Box::::new(const 1_i32) -> [return: bb1, unwind: bb7]; } bb1: { StorageLive(_3); - _3 = Box::::new(const 2_i32) -> [return: bb2, unwind: bb8]; + _3 = Box::::new(const 2_i32) -> [return: bb2, unwind: bb6]; } bb2: { _1 = [move _2, move _3]; - drop(_3) -> [return: bb3, unwind: bb8]; - } - - bb3: { StorageDead(_3); - drop(_2) -> [return: bb4, unwind: bb9]; - } - - bb4: { StorageDead(_2); nop; PlaceMention(_1); StorageLive(_4); _4 = move _1[1 of 2]; _0 = const (); - drop(_4) -> [return: bb5, unwind: bb7]; + drop(_4) -> [return: bb3, unwind: bb5]; } - bb5: { + bb3: { StorageDead(_4); - drop(_1) -> [return: bb6, unwind: bb9]; + drop(_1) -> [return: bb4, unwind: bb7]; } - bb6: { + bb4: { StorageDead(_1); return; } - bb7 (cleanup): { - drop(_1) -> [return: bb9, unwind terminate(cleanup)]; + bb5 (cleanup): { + drop(_1) -> [return: bb7, unwind terminate(cleanup)]; } - bb8 (cleanup): { - drop(_2) -> [return: bb9, unwind terminate(cleanup)]; + bb6 (cleanup): { + drop(_2) -> [return: bb7, unwind terminate(cleanup)]; } - bb9 (cleanup): { + bb7 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/write_box_via_move.box_new.CleanupPostBorrowck.after.mir b/tests/mir-opt/building/write_box_via_move.box_new.CleanupPostBorrowck.after.mir index 0050151e89b1b..773664ed73ea2 100644 --- a/tests/mir-opt/building/write_box_via_move.box_new.CleanupPostBorrowck.after.mir +++ b/tests/mir-opt/building/write_box_via_move.box_new.CleanupPostBorrowck.after.mir @@ -13,7 +13,7 @@ fn box_new(_1: T) -> Box<[T; 1024]> { bb0: { StorageLive(_2); - _2 = Box::<[T; 1024]>::new_uninit() -> [return: bb1, unwind: bb7]; + _2 = Box::<[T; 1024]>::new_uninit() -> [return: bb1, unwind: bb4]; } bb1: { @@ -26,33 +26,21 @@ fn box_new(_1: T) -> Box<[T; 1024]> { ((((*_4).1: std::mem::ManuallyDrop<[T; 1024]>).0: std::mem::MaybeDangling<[T; 1024]>).0: [T; 1024]) = [move _5; 1024]; StorageDead(_5); _3 = move _4; - drop(_4) -> [return: bb2, unwind: bb5]; - } - - bb2: { StorageDead(_4); - _0 = Box::>::assume_init(move _3) -> [return: bb3, unwind: bb5]; + _0 = Box::>::assume_init(move _3) -> [return: bb2, unwind: bb3]; } - bb3: { + bb2: { StorageDead(_3); - drop(_2) -> [return: bb4, unwind: bb7]; - } - - bb4: { StorageDead(_2); return; } - bb5 (cleanup): { - drop(_3) -> [return: bb6, unwind terminate(cleanup)]; - } - - bb6 (cleanup): { - drop(_2) -> [return: bb7, unwind terminate(cleanup)]; + bb3 (cleanup): { + drop(_3) -> [return: bb4, unwind terminate(cleanup)]; } - bb7 (cleanup): { + bb4 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/write_box_via_move.vec_macro.CleanupPostBorrowck.after.mir b/tests/mir-opt/building/write_box_via_move.vec_macro.CleanupPostBorrowck.after.mir index 2410e4d31b486..af775fdaac026 100644 --- a/tests/mir-opt/building/write_box_via_move.vec_macro.CleanupPostBorrowck.after.mir +++ b/tests/mir-opt/building/write_box_via_move.vec_macro.CleanupPostBorrowck.after.mir @@ -8,30 +8,26 @@ fn vec_macro() -> Vec { bb0: { StorageLive(_1); StorageLive(_2); - _2 = Box::<[i32; 8]>::new_uninit() -> [return: bb1, unwind: bb5]; + _2 = Box::<[i32; 8]>::new_uninit() -> [return: bb1, unwind: bb4]; } bb1: { ((((*_2).1: std::mem::ManuallyDrop<[i32; 8]>).0: std::mem::MaybeDangling<[i32; 8]>).0: [i32; 8]) = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32, const 6_i32, const 7_i32]; _1 = move _2; - drop(_2) -> [return: bb2, unwind: bb4]; - } - - bb2: { StorageDead(_2); - _0 = std::boxed::box_assume_init_into_vec_unsafe::(move _1) -> [return: bb3, unwind: bb4]; + _0 = std::boxed::box_assume_init_into_vec_unsafe::(move _1) -> [return: bb2, unwind: bb3]; } - bb3: { + bb2: { StorageDead(_1); return; } - bb4 (cleanup): { - drop(_1) -> [return: bb5, unwind terminate(cleanup)]; + bb3 (cleanup): { + drop(_1) -> [return: bb4, unwind terminate(cleanup)]; } - bb5 (cleanup): { + bb4 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/write_via_move.box_new.CleanupPostBorrowck.after.mir b/tests/mir-opt/building/write_via_move.box_new.CleanupPostBorrowck.after.mir index 6a6e984023b75..a5d89246af8fa 100644 --- a/tests/mir-opt/building/write_via_move.box_new.CleanupPostBorrowck.after.mir +++ b/tests/mir-opt/building/write_via_move.box_new.CleanupPostBorrowck.after.mir @@ -20,7 +20,7 @@ fn box_new(_1: T) -> Box<[T; 1024]> { bb0: { StorageLive(_2); - _2 = Box::<[T; 1024]>::new_uninit() -> [return: bb1, unwind: bb7]; + _2 = Box::<[T; 1024]>::new_uninit() -> [return: bb1, unwind: bb5]; } bb1: { @@ -30,7 +30,7 @@ fn box_new(_1: T) -> Box<[T; 1024]> { StorageLive(_5); _5 = &mut (*_2); _4 = &mut (*_5); - _3 = MaybeUninit::<[T; 1024]>::as_mut_ptr(move _4) -> [return: bb2, unwind: bb6]; + _3 = MaybeUninit::<[T; 1024]>::as_mut_ptr(move _4) -> [return: bb2, unwind: bb4]; } bb2: { @@ -48,29 +48,21 @@ fn box_new(_1: T) -> Box<[T; 1024]> { StorageDead(_6); StorageLive(_9); _9 = move _2; - _0 = Box::>::assume_init(move _9) -> [return: bb3, unwind: bb5]; + _0 = Box::>::assume_init(move _9) -> [return: bb3, unwind: bb4]; } bb3: { StorageDead(_9); StorageDead(_3); - drop(_2) -> [return: bb4, unwind: bb7]; - } - - bb4: { StorageDead(_2); return; } - bb5 (cleanup): { - drop(_9) -> [return: bb6, unwind terminate(cleanup)]; - } - - bb6 (cleanup): { - drop(_2) -> [return: bb7, unwind terminate(cleanup)]; + bb4 (cleanup): { + drop(_2) -> [return: bb5, unwind terminate(cleanup)]; } - bb7 (cleanup): { + bb5 (cleanup): { resume; } } diff --git a/tests/mir-opt/coroutine/async_await.b-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_await.b-{closure#0}.StateTransform.diff index aaf739ff26eb9..4daa327185e62 100644 --- a/tests/mir-opt/coroutine/async_await.b-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_await.b-{closure#0}.StateTransform.diff @@ -81,17 +81,17 @@ - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); -- _5 = a() -> [return: bb1, unwind: bb47]; +- _5 = a() -> [return: bb1, unwind: bb41]; + _41 = move _2 as std::ptr::NonNull> (Transmute); + _40 = std::future::ResumeTy(move _41); + _39 = copy (_1.0: &mut {async fn body of b()}); + _38 = discriminant((*_39)); -+ switchInt(move _38) -> [0: bb46, 1: bb45, 2: bb44, 3: bb42, 4: bb43, otherwise: bb7]; ++ switchInt(move _38) -> [0: bb42, 1: bb41, 2: bb40, 3: bb38, 4: bb39, 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]; +- _4 = <{async fn body of a()} as IntoFuture>::into_future(move _5) -> [return: bb2, unwind: bb41]; ++ _4 = <{async fn body of a()} as IntoFuture>::into_future(move _5) -> [return: bb2, unwind: bb33]; } bb2: { @@ -113,8 +113,8 @@ - _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]; +- _10 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _11) -> [return: bb4, unwind: bb38]; ++ _10 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _11) -> [return: bb4, unwind: bb30]; } bb4: { @@ -123,7 +123,7 @@ StorageLive(_14); StorageLive(_15); - _15 = copy _2; -- _14 = std::future::get_context::<'_, '_>(move _15) -> [return: bb5, unwind: bb41]; +- _14 = std::future::get_context::<'_, '_>(move _15) -> [return: bb5, unwind: bb36]; + _15 = copy _40; + _14 = copy (_15.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb5; @@ -132,8 +132,8 @@ 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]; +- _9 = <{async fn body of a()} as Future>::poll(move _10, move _13) -> [return: bb6, unwind: bb37]; ++ _9 = <{async fn body of a()} as Future>::poll(move _10, move _13) -> [return: bb6, unwind: bb29]; } bb6: { @@ -157,7 +157,7 @@ StorageLive(_19); StorageLive(_20); _20 = (); -- _19 = yield(move _20) -> [resume: bb10, drop: bb28]; +- _19 = yield(move _20) -> [resume: bb10, drop: bb25]; + _0 = Poll::<()>::Pending; + StorageDead(_3); + StorageDead(_4); @@ -176,8 +176,8 @@ 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]; +- drop(_6) -> [return: bb11, unwind: bb40]; ++ drop((((*_39) as variant#3).0: {async fn body of a()})) -> [return: bb11, unwind: bb32]; } bb10: { @@ -192,34 +192,30 @@ 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]; +- _22 = a() -> [return: bb12, unwind: bb34]; ++ _22 = a() -> [return: bb12, unwind: bb27]; } - 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]; + bb12: { +- _21 = <{async fn body of a()} as IntoFuture>::into_future(move _22) -> [return: bb13, unwind: bb34]; ++ _21 = <{async fn body of a()} as IntoFuture>::into_future(move _22) -> [return: bb13, unwind: bb27]; } - bb14: { + bb13: { StorageDead(_22); PlaceMention(_21); - StorageLive(_23); - _23 = move _21; + nop; + (((*_39) as variant#4).0: {async fn body of a()}) = move _21; - goto -> bb15; + goto -> bb14; } - bb15: { + bb14: { StorageLive(_24); StorageLive(_25); StorageLive(_26); @@ -228,38 +224,38 @@ - _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]; +- _26 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _27) -> [return: bb15, unwind: bb31]; ++ _26 = Pin::<&mut {async fn body of a()}>::new_unchecked(move _27) -> [return: bb15, unwind: bb24]; } - bb16: { + bb15: { StorageDead(_27); StorageLive(_29); StorageLive(_30); StorageLive(_31); - _31 = copy _2; -- _30 = std::future::get_context::<'_, '_>(move _31) -> [return: bb17, unwind: bb33]; +- _30 = std::future::get_context::<'_, '_>(move _31) -> [return: bb16, unwind: bb29]; + _31 = copy _40; + _30 = copy (_31.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb17; ++ goto -> bb16; } - bb17: { + bb16: { _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]; +- _25 = <{async fn body of a()} as Future>::poll(move _26, move _29) -> [return: bb17, unwind: bb30]; ++ _25 = <{async fn body of a()} as Future>::poll(move _26, move _29) -> [return: bb17, unwind: bb23]; } - bb18: { + bb17: { StorageDead(_29); StorageDead(_26); PlaceMention(_25); _32 = discriminant(_25); - switchInt(move _32) -> [0: bb20, 1: bb19, otherwise: bb7]; + switchInt(move _32) -> [0: bb19, 1: bb18, otherwise: bb7]; } - bb19: { + bb18: { _24 = const (); StorageDead(_30); StorageDead(_28); @@ -268,7 +264,7 @@ StorageLive(_35); StorageLive(_36); _36 = (); -- _35 = yield(move _36) -> [resume: bb21, drop: bb25]; +- _35 = yield(move _36) -> [resume: bb20, drop: bb23]; + _0 = Poll::<()>::Pending; + StorageDead(_21); + StorageDead(_35); @@ -277,7 +273,7 @@ + return; } - bb20: { + bb19: { StorageLive(_33); _33 = copy ((_25 as Ready).0: ()); - _0 = copy _33; @@ -287,217 +283,194 @@ 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]; +- drop(_23) -> [return: bb21, unwind: bb33]; ++ drop((((*_39) as variant#4).0: {async fn body of a()})) -> [return: bb21, unwind: bb26]; } - bb21: { + bb20: { StorageDead(_36); - _2 = move _35; + _40 = move _35; StorageDead(_35); _7 = const (); - goto -> bb15; + goto -> bb14; } - bb22: { + bb21: { - StorageDead(_23); + nop; - goto -> bb23; - } - - bb23: { StorageDead(_21); -- drop(_1) -> [return: bb24, unwind: bb50]; -+ goto -> bb24; +- drop(_1) -> [return: bb22, unwind: bb44]; ++ goto -> bb22; } - bb24: { + bb22: { + _0 = Poll::<()>::Ready(move _37); + discriminant((*_39)) = 1; return; } -- bb25: { +- bb23: { - StorageDead(_36); - StorageDead(_35); -- drop(_23) -> [return: bb26, unwind: bb51]; +- drop(_23) -> [return: bb24, unwind: bb45]; - } - -- bb26: { +- bb24: { - StorageDead(_23); -- goto -> bb27; -- } -- -- bb27: { - StorageDead(_21); -- goto -> bb31; +- goto -> bb27; - } - -- bb28: { +- bb25: { - StorageDead(_20); - StorageDead(_19); -- drop(_6) -> [return: bb29, unwind: bb53]; +- drop(_6) -> [return: bb26, unwind: bb46]; - } - -- bb29: { +- bb26: { - StorageDead(_6); -- goto -> bb30; -- } -- -- bb30: { - StorageDead(_4); - StorageDead(_3); -- goto -> bb31; +- goto -> bb27; - } - -- bb31: { -- drop(_1) -> [return: bb32, unwind: bb50]; +- bb27: { +- drop(_1) -> [return: bb28, unwind: bb44]; - } - -- bb32: { +- bb28: { - coroutine_drop; - } - -- bb33 (cleanup): { +- bb29 (cleanup): { - StorageDead(_31); -- goto -> bb34; +- goto -> bb30; - } - -- bb34 (cleanup): { -+ bb25 (cleanup): { +- bb30 (cleanup): { ++ bb23 (cleanup): { StorageDead(_29); StorageDead(_26); StorageDead(_30); -- goto -> bb36; -+ goto -> bb27; +- goto -> bb32; ++ goto -> bb25; } -- bb35 (cleanup): { -+ bb26 (cleanup): { +- bb31 (cleanup): { ++ bb24 (cleanup): { StorageDead(_27); StorageDead(_26); -- goto -> bb36; -+ goto -> bb27; +- goto -> bb32; ++ goto -> bb25; } -- bb36 (cleanup): { -+ bb27 (cleanup): { +- bb32 (cleanup): { ++ bb25 (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)]; +- drop(_23) -> [return: bb33, unwind terminate(cleanup)]; ++ drop((((*_39) as variant#4).0: {async fn body of a()})) -> [return: bb26, unwind terminate(cleanup)]; } -- bb37 (cleanup): { +- bb33 (cleanup): { - StorageDead(_23); -- goto -> bb40; -+ bb28 (cleanup): { +- goto -> bb35; ++ bb26 (cleanup): { + nop; -+ goto -> bb31; ++ goto -> bb28; } -- bb38 (cleanup): { -- goto -> bb39; -+ bb29 (cleanup): { -+ goto -> bb30; - } - -- bb39 (cleanup): { -+ bb30 (cleanup): { +- bb34 (cleanup): { ++ bb27 (cleanup): { StorageDead(_22); -- goto -> bb40; -+ goto -> bb31; +- goto -> bb35; ++ goto -> bb28; } -- bb40 (cleanup): { -+ bb31 (cleanup): { +- bb35 (cleanup): { ++ bb28 (cleanup): { StorageDead(_21); -- goto -> bb49; -+ goto -> bb39; +- goto -> bb43; ++ goto -> bb35; } -- bb41 (cleanup): { +- bb36 (cleanup): { - StorageDead(_15); -- goto -> bb42; +- goto -> bb37; - } - -- bb42 (cleanup): { -+ bb32 (cleanup): { +- bb37 (cleanup): { ++ bb29 (cleanup): { StorageDead(_13); StorageDead(_10); StorageDead(_14); -- goto -> bb44; -+ goto -> bb34; +- goto -> bb39; ++ goto -> bb31; } -- bb43 (cleanup): { -+ bb33 (cleanup): { +- bb38 (cleanup): { ++ bb30 (cleanup): { StorageDead(_11); StorageDead(_10); -- goto -> bb44; -+ goto -> bb34; +- goto -> bb39; ++ goto -> bb31; } -- bb44 (cleanup): { -+ bb34 (cleanup): { +- bb39 (cleanup): { ++ bb31 (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)]; +- drop(_6) -> [return: bb40, unwind terminate(cleanup)]; ++ drop((((*_39) as variant#3).0: {async fn body of a()})) -> [return: bb32, unwind terminate(cleanup)]; } -- bb45 (cleanup): { +- bb40 (cleanup): { - StorageDead(_6); -- goto -> bb48; -+ bb35 (cleanup): { +- goto -> bb42; ++ bb32 (cleanup): { + nop; -+ goto -> bb38; - } - -- bb46 (cleanup): { -- goto -> bb47; -+ bb36 (cleanup): { -+ goto -> bb37; ++ goto -> bb34; } -- bb47 (cleanup): { -+ bb37 (cleanup): { +- bb41 (cleanup): { ++ bb33 (cleanup): { StorageDead(_5); -- goto -> bb48; -+ goto -> bb38; +- goto -> bb42; ++ goto -> bb34; } -- bb48 (cleanup): { -+ bb38 (cleanup): { +- bb42 (cleanup): { ++ bb34 (cleanup): { StorageDead(_4); StorageDead(_3); -- goto -> bb49; -+ goto -> bb39; +- goto -> bb43; ++ goto -> bb35; } -- bb49 (cleanup): { -- drop(_1) -> [return: bb50, unwind terminate(cleanup)]; -+ bb39 (cleanup): { -+ goto -> bb40; +- bb43 (cleanup): { +- drop(_1) -> [return: bb44, unwind terminate(cleanup)]; ++ bb35 (cleanup): { ++ goto -> bb36; } -- bb50 (cleanup): { -+ bb40 (cleanup): { -+ goto -> bb41; +- bb44 (cleanup): { ++ bb36 (cleanup): { ++ goto -> bb37; + } + -+ bb41 (cleanup): { ++ bb37 (cleanup): { + discriminant((*_39)) = 2; resume; } -- bb51 (cleanup): { +- bb45 (cleanup): { - StorageDead(_23); -- goto -> bb52; -+ bb42: { +- StorageDead(_21); +- goto -> bb47; ++ bb38: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_19); @@ -506,39 +479,34 @@ + goto -> bb10; } -- bb52 (cleanup): { -- StorageDead(_21); -- goto -> bb55; -+ bb43: { +- bb46 (cleanup): { +- StorageDead(_6); +- StorageDead(_4); +- StorageDead(_3); +- goto -> bb47; ++ bb39: { + StorageLive(_21); + StorageLive(_35); + StorageLive(_36); + _35 = move _40; -+ goto -> bb21; ++ goto -> bb20; } -- bb53 (cleanup): { -- StorageDead(_6); -- goto -> bb54; -+ bb44: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb44, unwind continue]; - } - -- bb54 (cleanup): { -- StorageDead(_4); -- StorageDead(_3); -- goto -> bb55; -+ bb45: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb45, unwind continue]; - } - -- bb55 (cleanup): { -- drop(_1) -> [return: bb50, unwind terminate(cleanup)]; -+ bb46: { +- bb47 (cleanup): { +- drop(_1) -> [return: bb44, unwind terminate(cleanup)]; ++ bb40: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb40, unwind continue]; ++ } ++ ++ bb41: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb41, unwind continue]; ++ } ++ ++ bb42: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); -+ _5 = a() -> [return: bb1, unwind: bb37]; ++ _5 = a() -> [return: bb1, unwind: bb33]; } } diff --git a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff index 55d6ee5fcd4d7..0fa9e860a4b7d 100644 --- a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff +++ b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.ElaborateDrops.diff @@ -37,179 +37,145 @@ StorageLive(_5); _5 = AsyncInt(const 2_i32); _3 = [move _4, move _5]; - goto -> bb1; - } - - bb1: { StorageDead(_5); - goto -> bb2; - } - - bb2: { StorageDead(_4); _0 = const (); -- drop(_3) -> [return: bb3, unwind: bb11, drop: bb7]; -+ goto -> bb34; +- drop(_3) -> [return: bb1, unwind: bb5, drop: bb3]; ++ goto -> bb27; } - bb3: { + bb1: { StorageDead(_3); -- drop(_1) -> [return: bb4, drop: bb8, unwind continue]; -+ drop(_1) -> [return: bb4, unwind: bb12]; +- drop(_1) -> [return: bb2, drop: bb4, unwind continue]; ++ drop(_1) -> [return: bb2, unwind: bb6]; } - bb4: { + bb2: { return; } - bb5: { - StorageDead(_5); - drop(_4) -> [return: bb6, unwind: bb13]; - } - - bb6: { - StorageDead(_4); - goto -> bb7; - } - - bb7: { + bb3: { StorageDead(_3); -- drop(_1) -> [return: bb8, unwind continue]; -+ goto -> bb8; +- drop(_1) -> [return: bb4, unwind continue]; ++ goto -> bb4; } - bb8: { + bb4: { coroutine_drop; } - bb9 (cleanup): { - StorageDead(_5); - goto -> bb10; - } - - bb10 (cleanup): { - StorageDead(_4); - goto -> bb11; - } - - bb11 (cleanup): { + bb5 (cleanup): { StorageDead(_3); - drop(_1) -> [return: bb12, unwind terminate(cleanup)]; + drop(_1) -> [return: bb6, unwind terminate(cleanup)]; } - bb12 (cleanup): { + bb6 (cleanup): { resume; - } - - bb13 (cleanup): { - StorageDead(_4); - StorageDead(_3); - drop(_1) -> [return: bb12, unwind terminate(cleanup)]; + } + -+ bb14: { ++ bb7: { + StorageDead(_6); -+ goto -> bb3; ++ goto -> bb1; + } + -+ bb15: { ++ bb8: { + StorageDead(_6); -+ goto -> bb7; ++ goto -> bb3; + } + -+ bb16 (cleanup): { ++ bb9 (cleanup): { + StorageDead(_6); -+ goto -> bb11; ++ goto -> bb5; + } + -+ bb17: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb17, unwind: bb16]; ++ bb10: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb10, unwind: bb9]; + } + -+ bb18: { ++ bb11: { + _2 = move _7; + StorageDead(_7); -+ goto -> bb17; ++ goto -> bb10; + } + -+ bb19: { ++ bb12: { + _2 = move _7; + StorageDead(_7); -+ goto -> bb25; ++ goto -> bb18; + } + -+ bb20: { ++ bb13: { + StorageLive(_7); -+ _7 = yield(const ()) -> [resume: bb18, drop: bb19]; ++ _7 = yield(const ()) -> [resume: bb11, drop: bb12]; + } + -+ bb21: { ++ bb14: { + unreachable; + } + -+ bb22: { ++ bb15: { + _9 = discriminant(_8); -+ switchInt(move _9) -> [0: bb15, 1: bb20, otherwise: bb21]; ++ switchInt(move _9) -> [0: bb8, 1: bb13, otherwise: bb14]; + } + -+ bb23: { -+ _8 = as Future>::poll(move _10, move _11) -> [return: bb22, unwind: bb16]; ++ bb16: { ++ _8 = as Future>::poll(move _10, move _11) -> [return: bb15, unwind: bb9]; + } + -+ bb24: { ++ bb17: { + _12 = move _2; -+ _11 = std::future::get_context::<'_, '_>(move _12) -> [return: bb23, unwind: bb16]; ++ _11 = std::future::get_context::<'_, '_>(move _12) -> [return: bb16, unwind: bb9]; + } + -+ bb25: { ++ bb18: { + _13 = &mut _6; -+ _10 = Pin::<&mut impl Future>::new_unchecked(move _13) -> [return: bb24, unwind: bb16]; ++ _10 = Pin::<&mut impl Future>::new_unchecked(move _13) -> [return: bb17, unwind: bb9]; + } + -+ bb26: { ++ bb19: { + _2 = move _14; + StorageDead(_14); -+ goto -> bb32; ++ goto -> bb25; + } + -+ bb27: { ++ bb20: { + _2 = move _14; + StorageDead(_14); -+ goto -> bb25; ++ goto -> bb18; + } + -+ bb28: { ++ bb21: { + StorageLive(_14); -+ _14 = yield(const ()) -> [resume: bb26, drop: bb27]; ++ _14 = yield(const ()) -> [resume: bb19, drop: bb20]; + } + -+ bb29: { ++ bb22: { + _16 = discriminant(_15); -+ switchInt(move _16) -> [0: bb14, 1: bb28, otherwise: bb21]; ++ switchInt(move _16) -> [0: bb7, 1: bb21, otherwise: bb14]; + } + -+ bb30: { -+ _15 = as Future>::poll(move _17, move _18) -> [return: bb29, unwind: bb16]; ++ bb23: { ++ _15 = as Future>::poll(move _17, move _18) -> [return: bb22, unwind: bb9]; + } + -+ bb31: { ++ bb24: { + _19 = move _2; -+ _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb30, unwind: bb16]; ++ _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb23, unwind: bb9]; + } + -+ bb32: { ++ bb25: { + _20 = &mut _6; -+ _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb31, unwind: bb16]; ++ _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb24, unwind: bb9]; + } + -+ bb33: { ++ bb26: { + StorageLive(_6); -+ _6 = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb32, unwind: bb16]; ++ _6 = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb25, unwind: bb9]; + } + -+ bb34: { ++ bb27: { + _22 = &mut _3; -+ _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb33, unwind: bb11]; ++ _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb26, unwind: bb5]; } } diff --git a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.StateTransform.diff index f80266a1b2d00..47a7b9d4d3642 100644 --- a/tests/mir-opt/coroutine/async_drop.array-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_drop.array-{closure#0}.StateTransform.diff @@ -60,99 +60,89 @@ - StorageLive(_5); - _5 = AsyncInt(const 2_i32); - _3 = [move _4, move _5]; -- goto -> bb1; +- StorageDead(_5); +- StorageDead(_4); +- _0 = const (); +- goto -> bb27; + _27 = move _2 as std::ptr::NonNull> (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]; ++ switchInt(move _24) -> [0: bb23, 1: bb22, 2: bb21, 3: bb19, 4: bb20, otherwise: bb9]; } 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]; +- drop(_1) -> [return: bb2, unwind: bb6]; + nop; -+ goto -> bb4; ++ goto -> bb2; } - bb4: { + bb2: { + _0 = Poll::<()>::Ready(move (((*_25) as variant#4).0: ())); + discriminant((*_25)) = 1; return; } -- bb5: { +- bb3: { - StorageDead(_3); -+ bb5 (cleanup): { ++ bb3 (cleanup): { + nop; - goto -> bb6; + goto -> bb4; } -- bb6: { +- bb4: { - coroutine_drop; -+ bb6 (cleanup): { -+ goto -> bb20; ++ bb4 (cleanup): { ++ goto -> bb18; } -- bb7 (cleanup): { +- bb5 (cleanup): { - StorageDead(_3); -- drop(_1) -> [return: bb8, unwind terminate(cleanup)]; -+ bb7: { +- drop(_1) -> [return: bb6, unwind terminate(cleanup)]; ++ bb5: { + nop; -+ goto -> bb3; ++ goto -> bb1; } - bb8 (cleanup): { + bb6 (cleanup): { - resume; + nop; -+ goto -> bb5; ++ goto -> bb3; } - bb9: { + bb7: { - StorageDead(_6); -- goto -> bb3; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb9, unwind: bb8]; +- goto -> bb1; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb7, unwind: bb6]; } - bb10: { + bb8: { - StorageDead(_6); -- goto -> bb5; +- goto -> bb3; + _26 = move _7; + StorageDead(_7); -+ goto -> bb9; ++ goto -> bb7; } -- bb11 (cleanup): { +- bb9 (cleanup): { - StorageDead(_6); -- goto -> bb7; -+ bb11: { +- goto -> bb5; ++ bb9: { + unreachable; } - bb12: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb12, unwind: bb11]; + bb10: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb10, unwind: bb9]; + _26 = move _14; + StorageDead(_14); -+ goto -> bb17; ++ goto -> bb15; } - bb13: { + bb11: { - _2 = move _7; - StorageDead(_7); -- goto -> bb12; +- goto -> bb10; + StorageLive(_14); + _0 = Poll::<()>::Pending; + StorageDead(_14); @@ -160,114 +150,117 @@ + return; } - bb14: { + bb12: { - _2 = move _7; - StorageDead(_7); -- goto -> bb20; +- goto -> bb18; + _16 = discriminant(_15); -+ switchInt(move _16) -> [0: bb7, 1: bb13, otherwise: bb11]; ++ switchInt(move _16) -> [0: bb5, 1: bb11, otherwise: bb9]; } - bb15: { + bb13: { - StorageLive(_7); -- _7 = yield(const ()) -> [resume: bb13, drop: bb14]; -+ _15 = as Future>::poll(move _17, move _18) -> [return: bb14, unwind: bb8]; +- _7 = yield(const ()) -> [resume: bb11, drop: bb12]; ++ _15 = as Future>::poll(move _17, move _18) -> [return: bb12, unwind: bb6]; } - bb16: { + bb14: { - unreachable; + _19 = move _26; + _18 = copy (_19.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb15; ++ goto -> bb13; } - bb17: { + bb15: { - _9 = discriminant(_8); -- switchInt(move _9) -> [0: bb10, 1: bb15, otherwise: bb16]; +- switchInt(move _9) -> [0: bb8, 1: bb13, otherwise: bb14]; + _20 = &mut (((*_25) as variant#4).2: impl std::future::Future); -+ _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb16, unwind: bb8]; ++ _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb14, unwind: bb6]; } - bb18: { -- _8 = as Future>::poll(move _10, move _11) -> [return: bb17, unwind: bb11]; + bb16: { +- _8 = as Future>::poll(move _10, move _11) -> [return: bb15, unwind: bb9]; + nop; -+ (((*_25) as variant#4).2: impl std::future::Future) = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb17, unwind: bb8]; ++ (((*_25) as variant#4).2: impl std::future::Future) = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb15, unwind: bb6]; } - bb19: { + bb17: { - _12 = move _2; -- _11 = std::future::get_context::<'_, '_>(move _12) -> [return: bb18, unwind: bb11]; +- _11 = std::future::get_context::<'_, '_>(move _12) -> [return: bb16, unwind: bb9]; + _22 = &mut (((*_25) as variant#4).1: [AsyncInt; 2]); -+ _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb18, unwind: bb5]; ++ _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb16, unwind: bb3]; } -- bb20: { +- bb18: { - _13 = &mut _6; -- _10 = Pin::<&mut impl Future>::new_unchecked(move _13) -> [return: bb19, unwind: bb11]; -+ bb20 (cleanup): { +- _10 = Pin::<&mut impl Future>::new_unchecked(move _13) -> [return: bb17, unwind: bb9]; ++ bb18 (cleanup): { + discriminant((*_25)) = 2; + resume; } - bb21: { + bb19: { - _2 = move _14; - StorageDead(_14); -- goto -> bb27; +- goto -> bb25; + StorageLive(_7); + _7 = move _26; -+ goto -> bb10; ++ goto -> bb8; } - bb22: { + bb20: { - _2 = move _14; - StorageDead(_14); -- goto -> bb20; +- goto -> bb18; + StorageLive(_14); + _14 = move _26; -+ goto -> bb12; ++ goto -> bb10; } - bb23: { + bb21: { - StorageLive(_14); -- _14 = yield(const ()) -> [resume: bb21, drop: bb22]; -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb23, unwind continue]; +- _14 = yield(const ()) -> [resume: bb19, drop: bb20]; ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb21, unwind continue]; } - bb24: { + bb22: { - _16 = discriminant(_15); -- switchInt(move _16) -> [0: bb9, 1: bb23, otherwise: bb16]; -+ assert(const false, "`async fn` resumed after completion") -> [success: bb24, unwind continue]; +- switchInt(move _16) -> [0: bb7, 1: bb21, otherwise: bb14]; ++ assert(const false, "`async fn` resumed after completion") -> [success: bb22, unwind continue]; } - bb25: { -- _15 = as Future>::poll(move _17, move _18) -> [return: bb24, unwind: bb11]; + bb23: { +- _15 = as Future>::poll(move _17, move _18) -> [return: bb22, unwind: bb9]; - } - -- bb26: { +- bb24: { - _19 = move _2; -- _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb25, unwind: bb11]; +- _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb23, unwind: bb9]; - } - -- bb27: { +- bb25: { - _20 = &mut _6; -- _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb26, unwind: bb11]; +- _17 = Pin::<&mut impl Future>::new_unchecked(move _20) -> [return: bb24, unwind: bb9]; - } - -- bb28: { +- bb26: { - StorageLive(_6); -- _6 = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb27, unwind: bb11]; +- _6 = async_drop_in_place::<[AsyncInt; 2]>(copy (_21.0: &mut [AsyncInt; 2])) -> [return: bb25, unwind: bb9]; - } - -- bb29: { +- bb27: { - _22 = &mut _3; -- _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb28, unwind: bb7]; +- _21 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _22) -> [return: bb26, unwind: bb5]; + 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; ++ StorageDead(_5); ++ StorageDead(_4); ++ (((*_25) as variant#4).0: ()) = const (); ++ goto -> bb17; } } diff --git a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff index a6adfd7ec228e..bf567e35e04b2 100644 --- a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff +++ b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.ElaborateDrops.diff @@ -234,15 +234,7 @@ StorageLive(_7); _7 = AsyncInt(const 2_i32); _5 = [move _6, move _7]; - goto -> bb1; - } - - bb1: { StorageDead(_7); - goto -> bb2; - } - - bb2: { StorageDead(_6); StorageLive(_8); StorageLive(_9); @@ -250,15 +242,7 @@ StorageLive(_10); _10 = AsyncInt(const 4_i32); _8 = AsyncStruct { i: const 3_i32, a: move _10, b: move _9 }; - goto -> bb3; - } - - bb3: { StorageDead(_10); - goto -> bb4; - } - - bb4: { StorageDead(_9); StorageLive(_11); StorageLive(_12); @@ -268,37 +252,21 @@ StorageLive(_14); _14 = AsyncInt(const 9_i32); _11 = SyncThenAsync { i: const 6_i32, a: move _12, b: move _13, c: move _14 }; - goto -> bb5; - } - - bb5: { StorageDead(_14); - goto -> bb6; - } - - bb6: { StorageDead(_13); - goto -> bb7; - } - - bb7: { StorageDead(_12); StorageLive(_15); StorageLive(_16); _16 = AsyncInt(const 10_i32); _15 = AsyncEnum::A(move _16); - goto -> bb8; - } - - bb8: { StorageDead(_16); StorageLive(_17); StorageLive(_18); _18 = AsyncInt(const 11_i32); - _17 = ManuallyDrop::::new(move _18) -> [return: bb9, unwind: bb50]; + _17 = ManuallyDrop::::new(move _18) -> [return: bb1, unwind: bb30]; } - bb9: { + bb1: { StorageDead(_18); StorageLive(_19); _19 = AsyncInt(const 12_i32); @@ -319,1317 +287,1197 @@ StorageLive(_26); _26 = {closure@$DIR/async_drop.rs:86:27: 86:35} { foo: move _25 }; _0 = const (); -- drop(_26) -> [return: bb10, unwind: bb44, drop: bb23]; -+ goto -> bb103; +- drop(_26) -> [return: bb2, unwind: bb26, drop: bb13]; ++ goto -> bb70; } - bb10: { + bb2: { StorageDead(_26); - goto -> bb11; - } - - bb11: { StorageDead(_25); -- drop(_24) -> [return: bb12, unwind: bb46, drop: bb25]; -+ goto -> bb123; +- drop(_24) -> [return: bb3, unwind: bb27, drop: bb15]; ++ goto -> bb90; } - bb12: { + bb3: { StorageDead(_24); - goto -> bb13; - } - - bb13: { StorageDead(_23); -- drop(_20) -> [return: bb14, unwind: bb48, drop: bb27]; -+ goto -> bb143; +- drop(_20) -> [return: bb4, unwind: bb28, drop: bb17]; ++ goto -> bb110; } - bb14: { + bb4: { StorageDead(_20); -- drop(_19) -> [return: bb15, unwind: bb49, drop: bb28]; -+ goto -> bb163; +- drop(_19) -> [return: bb5, unwind: bb29, drop: bb18]; ++ goto -> bb130; } - bb15: { + bb5: { StorageDead(_19); StorageDead(_17); -- drop(_15) -> [return: bb16, unwind: bb54, drop: bb30]; -+ goto -> bb183; +- drop(_15) -> [return: bb6, unwind: bb32, drop: bb19]; ++ goto -> bb150; } - bb16: { + bb6: { StorageDead(_15); -- drop(_11) -> [return: bb17, unwind: bb58, drop: bb34]; -+ goto -> bb203; +- drop(_11) -> [return: bb7, unwind: bb33, drop: bb20]; ++ goto -> bb170; } - bb17: { + bb7: { StorageDead(_11); -- drop(_8) -> [return: bb18, unwind: bb61, drop: bb37]; -+ goto -> bb223; +- drop(_8) -> [return: bb8, unwind: bb34, drop: bb21]; ++ goto -> bb190; } - bb18: { + bb8: { StorageDead(_8); -- drop(_5) -> [return: bb19, unwind: bb64, drop: bb40]; -+ goto -> bb243; +- drop(_5) -> [return: bb9, unwind: bb35, drop: bb22]; ++ goto -> bb210; } - bb19: { + bb9: { StorageDead(_5); -- drop(_4) -> [return: bb20, unwind: bb65, drop: bb41]; -+ goto -> bb263; +- drop(_4) -> [return: bb10, unwind: bb36, drop: bb23]; ++ goto -> bb230; } - bb20: { + bb10: { StorageDead(_4); - drop(_3) -> [return: bb21, unwind: bb66]; + drop(_3) -> [return: bb11, unwind: bb37]; } - bb21: { + bb11: { StorageDead(_3); -- drop(_1) -> [return: bb22, drop: bb43, unwind continue]; -+ drop(_1) -> [return: bb22, unwind: bb67]; +- drop(_1) -> [return: bb12, drop: bb25, unwind continue]; ++ drop(_1) -> [return: bb12, unwind: bb38]; } - bb22: { + bb12: { return; } - bb23: { + bb13: { StorageDead(_26); -- drop(_25) -> [return: bb24, unwind: bb68]; -+ goto -> bb24; +- drop(_25) -> [return: bb14, unwind: bb39]; ++ goto -> bb14; } - bb24: { + bb14: { StorageDead(_25); -- drop(_24) -> [return: bb25, unwind: bb69]; -+ goto -> bb25; +- drop(_24) -> [return: bb15, unwind: bb40]; ++ goto -> bb15; } - bb25: { + bb15: { StorageDead(_24); -- drop(_23) -> [return: bb26, unwind: bb70]; -+ goto -> bb26; +- drop(_23) -> [return: bb16, unwind: bb41]; ++ goto -> bb16; } - bb26: { + bb16: { StorageDead(_23); -- drop(_20) -> [return: bb27, unwind: bb71]; -+ goto -> bb27; +- drop(_20) -> [return: bb17, unwind: bb42]; ++ goto -> bb17; } - bb27: { + bb17: { StorageDead(_20); -- drop(_19) -> [return: bb28, unwind: bb72]; -+ goto -> bb28; +- drop(_19) -> [return: bb18, unwind: bb43]; ++ goto -> bb18; } - bb28: { + bb18: { StorageDead(_19); StorageDead(_17); -- drop(_15) -> [return: bb30, unwind: bb73]; -+ goto -> bb30; - } - - bb29: { - StorageDead(_16); - goto -> bb30; +- drop(_15) -> [return: bb19, unwind: bb44]; ++ goto -> bb19; } - bb30: { + bb19: { StorageDead(_15); -- drop(_11) -> [return: bb34, unwind: bb76]; -+ goto -> bb34; - } - - bb31: { - StorageDead(_14); - drop(_13) -> [return: bb32, unwind: bb74]; - } - - bb32: { - StorageDead(_13); - drop(_12) -> [return: bb33, unwind: bb75]; - } - - bb33: { - StorageDead(_12); - goto -> bb34; +- drop(_11) -> [return: bb20, unwind: bb45]; ++ goto -> bb20; } - bb34: { + bb20: { StorageDead(_11); -- drop(_8) -> [return: bb37, unwind: bb78]; -+ goto -> bb37; - } - - bb35: { - StorageDead(_10); - drop(_9) -> [return: bb36, unwind: bb77]; - } - - bb36: { - StorageDead(_9); - goto -> bb37; +- drop(_8) -> [return: bb21, unwind: bb46]; ++ goto -> bb21; } - bb37: { + bb21: { StorageDead(_8); -- drop(_5) -> [return: bb40, unwind: bb80]; -+ goto -> bb40; - } - - bb38: { - StorageDead(_7); - drop(_6) -> [return: bb39, unwind: bb79]; - } - - bb39: { - StorageDead(_6); - goto -> bb40; +- drop(_5) -> [return: bb22, unwind: bb47]; ++ goto -> bb22; } - bb40: { + bb22: { StorageDead(_5); -- drop(_4) -> [return: bb41, unwind: bb81]; -+ goto -> bb41; +- drop(_4) -> [return: bb23, unwind: bb48]; ++ goto -> bb23; } - bb41: { + bb23: { StorageDead(_4); -- drop(_3) -> [return: bb42, unwind: bb82]; -+ goto -> bb42; +- drop(_3) -> [return: bb24, unwind: bb49]; ++ goto -> bb24; } - bb42: { + bb24: { StorageDead(_3); -- drop(_1) -> [return: bb43, unwind continue]; -+ goto -> bb43; +- drop(_1) -> [return: bb25, unwind continue]; ++ goto -> bb25; } - bb43: { + bb25: { coroutine_drop; } - bb44 (cleanup): { + bb26 (cleanup): { StorageDead(_26); - goto -> bb45; - } - - bb45 (cleanup): { StorageDead(_25); - drop(_24) -> [return: bb46, unwind terminate(cleanup)]; + drop(_24) -> [return: bb27, unwind terminate(cleanup)]; } - bb46 (cleanup): { + bb27 (cleanup): { StorageDead(_24); - goto -> bb47; - } - - bb47 (cleanup): { StorageDead(_23); - drop(_20) -> [return: bb48, unwind terminate(cleanup)]; + drop(_20) -> [return: bb28, unwind terminate(cleanup)]; } - bb48 (cleanup): { + bb28 (cleanup): { StorageDead(_20); - drop(_19) -> [return: bb49, unwind terminate(cleanup)]; + drop(_19) -> [return: bb29, unwind terminate(cleanup)]; } - bb49 (cleanup): { + bb29 (cleanup): { StorageDead(_19); - goto -> bb52; + goto -> bb31; } - bb50 (cleanup): { - goto -> bb51; - } - - bb51 (cleanup): { + bb30 (cleanup): { StorageDead(_18); - goto -> bb52; + goto -> bb31; } - bb52 (cleanup): { + bb31 (cleanup): { StorageDead(_17); - drop(_15) -> [return: bb54, unwind terminate(cleanup)]; - } - - bb53 (cleanup): { - StorageDead(_16); - goto -> bb54; + drop(_15) -> [return: bb32, unwind terminate(cleanup)]; } - bb54 (cleanup): { + bb32 (cleanup): { StorageDead(_15); - drop(_11) -> [return: bb58, unwind terminate(cleanup)]; - } - - bb55 (cleanup): { - StorageDead(_14); - goto -> bb56; + drop(_11) -> [return: bb33, unwind terminate(cleanup)]; } - bb56 (cleanup): { - StorageDead(_13); - goto -> bb57; - } - - bb57 (cleanup): { - StorageDead(_12); - goto -> bb58; - } - - bb58 (cleanup): { + bb33 (cleanup): { StorageDead(_11); - drop(_8) -> [return: bb61, unwind terminate(cleanup)]; - } - - bb59 (cleanup): { - StorageDead(_10); - goto -> bb60; + drop(_8) -> [return: bb34, unwind terminate(cleanup)]; } - bb60 (cleanup): { - StorageDead(_9); - goto -> bb61; - } - - bb61 (cleanup): { + bb34 (cleanup): { StorageDead(_8); - drop(_5) -> [return: bb64, unwind terminate(cleanup)]; - } - - bb62 (cleanup): { - StorageDead(_7); - goto -> bb63; - } - - bb63 (cleanup): { - StorageDead(_6); - goto -> bb64; + drop(_5) -> [return: bb35, unwind terminate(cleanup)]; } - bb64 (cleanup): { + bb35 (cleanup): { StorageDead(_5); - drop(_4) -> [return: bb65, unwind terminate(cleanup)]; + drop(_4) -> [return: bb36, unwind terminate(cleanup)]; } - bb65 (cleanup): { + bb36 (cleanup): { StorageDead(_4); - drop(_3) -> [return: bb66, unwind terminate(cleanup)]; + drop(_3) -> [return: bb37, unwind terminate(cleanup)]; } - bb66 (cleanup): { + bb37 (cleanup): { StorageDead(_3); - drop(_1) -> [return: bb67, unwind terminate(cleanup)]; + drop(_1) -> [return: bb38, unwind terminate(cleanup)]; } - bb67 (cleanup): { + bb38 (cleanup): { resume; } - bb68 (cleanup): { + bb39 (cleanup): { StorageDead(_25); -- drop(_24) -> [return: bb69, unwind terminate(cleanup)]; -+ goto -> bb69; +- drop(_24) -> [return: bb40, unwind terminate(cleanup)]; ++ goto -> bb40; } - bb69 (cleanup): { + bb40 (cleanup): { StorageDead(_24); -- drop(_23) -> [return: bb70, unwind terminate(cleanup)]; -+ goto -> bb70; +- drop(_23) -> [return: bb41, unwind terminate(cleanup)]; ++ goto -> bb41; } - bb70 (cleanup): { + bb41 (cleanup): { StorageDead(_23); -- drop(_20) -> [return: bb71, unwind terminate(cleanup)]; -+ goto -> bb71; +- drop(_20) -> [return: bb42, unwind terminate(cleanup)]; ++ goto -> bb42; } - bb71 (cleanup): { + bb42 (cleanup): { StorageDead(_20); -- drop(_19) -> [return: bb72, unwind terminate(cleanup)]; -+ goto -> bb72; +- drop(_19) -> [return: bb43, unwind terminate(cleanup)]; ++ goto -> bb43; } - bb72 (cleanup): { + bb43 (cleanup): { StorageDead(_19); StorageDead(_17); -- drop(_15) -> [return: bb73, unwind terminate(cleanup)]; -+ goto -> bb73; +- drop(_15) -> [return: bb44, unwind terminate(cleanup)]; ++ goto -> bb44; } - bb73 (cleanup): { + bb44 (cleanup): { StorageDead(_15); -- drop(_11) -> [return: bb76, unwind terminate(cleanup)]; -+ goto -> bb76; +- drop(_11) -> [return: bb45, unwind terminate(cleanup)]; ++ goto -> bb45; } - bb74 (cleanup): { - StorageDead(_13); - drop(_12) -> [return: bb75, unwind terminate(cleanup)]; - } - - bb75 (cleanup): { - StorageDead(_12); - goto -> bb76; - } - - bb76 (cleanup): { + bb45 (cleanup): { StorageDead(_11); -- drop(_8) -> [return: bb78, unwind terminate(cleanup)]; -+ goto -> bb78; - } - - bb77 (cleanup): { - StorageDead(_9); - goto -> bb78; +- drop(_8) -> [return: bb46, unwind terminate(cleanup)]; ++ goto -> bb46; } - bb78 (cleanup): { + bb46 (cleanup): { StorageDead(_8); -- drop(_5) -> [return: bb80, unwind terminate(cleanup)]; -+ goto -> bb80; +- drop(_5) -> [return: bb47, unwind terminate(cleanup)]; ++ goto -> bb47; } - bb79 (cleanup): { - StorageDead(_6); - goto -> bb80; - } - - bb80 (cleanup): { + bb47 (cleanup): { StorageDead(_5); -- drop(_4) -> [return: bb81, unwind terminate(cleanup)]; -+ goto -> bb81; +- drop(_4) -> [return: bb48, unwind terminate(cleanup)]; ++ goto -> bb48; } - bb81 (cleanup): { + bb48 (cleanup): { StorageDead(_4); -- drop(_3) -> [return: bb82, unwind terminate(cleanup)]; -+ goto -> bb82; +- drop(_3) -> [return: bb49, unwind terminate(cleanup)]; ++ goto -> bb49; } - bb82 (cleanup): { + bb49 (cleanup): { StorageDead(_3); -- drop(_1) -> [return: bb67, unwind terminate(cleanup)]; -+ goto -> bb67; +- drop(_1) -> [return: bb38, unwind terminate(cleanup)]; ++ goto -> bb38; + } + -+ bb83: { ++ bb50: { + StorageDead(_27); -+ goto -> bb10; ++ goto -> bb2; + } + -+ bb84: { ++ bb51: { + StorageDead(_27); -+ goto -> bb23; ++ goto -> bb13; + } + -+ bb85 (cleanup): { ++ bb52 (cleanup): { + StorageDead(_27); -+ goto -> bb44; ++ goto -> bb26; + } + -+ bb86: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb86, unwind: bb85]; ++ bb53: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb53, unwind: bb52]; + } + -+ bb87: { ++ bb54: { + _2 = move _28; + StorageDead(_28); -+ goto -> bb86; ++ goto -> bb53; + } + -+ bb88: { ++ bb55: { + _2 = move _28; + StorageDead(_28); -+ goto -> bb94; ++ goto -> bb61; + } + -+ bb89: { ++ bb56: { + StorageLive(_28); -+ _28 = yield(const ()) -> [resume: bb87, drop: bb88]; ++ _28 = yield(const ()) -> [resume: bb54, drop: bb55]; + } + -+ bb90: { ++ bb57: { + unreachable; + } + -+ bb91: { ++ bb58: { + _30 = discriminant(_29); -+ switchInt(move _30) -> [0: bb84, 1: bb89, otherwise: bb90]; ++ switchInt(move _30) -> [0: bb51, 1: bb56, otherwise: bb57]; + } + -+ bb92: { -+ _29 = as Future>::poll(move _31, move _32) -> [return: bb91, unwind: bb85]; ++ bb59: { ++ _29 = as Future>::poll(move _31, move _32) -> [return: bb58, unwind: bb52]; + } + -+ bb93: { ++ bb60: { + _33 = move _2; -+ _32 = std::future::get_context::<'_, '_>(move _33) -> [return: bb92, unwind: bb85]; ++ _32 = std::future::get_context::<'_, '_>(move _33) -> [return: bb59, unwind: bb52]; + } + -+ bb94: { ++ bb61: { + _34 = &mut _27; -+ _31 = Pin::<&mut impl Future>::new_unchecked(move _34) -> [return: bb93, unwind: bb85]; ++ _31 = Pin::<&mut impl Future>::new_unchecked(move _34) -> [return: bb60, unwind: bb52]; + } + -+ bb95: { ++ bb62: { + _2 = move _35; + StorageDead(_35); -+ goto -> bb101; ++ goto -> bb68; + } + -+ bb96: { ++ bb63: { + _2 = move _35; + StorageDead(_35); -+ goto -> bb94; ++ goto -> bb61; + } + -+ bb97: { ++ bb64: { + StorageLive(_35); -+ _35 = yield(const ()) -> [resume: bb95, drop: bb96]; ++ _35 = yield(const ()) -> [resume: bb62, drop: bb63]; + } + -+ bb98: { ++ bb65: { + _37 = discriminant(_36); -+ switchInt(move _37) -> [0: bb83, 1: bb97, otherwise: bb90]; ++ switchInt(move _37) -> [0: bb50, 1: bb64, otherwise: bb57]; + } + -+ bb99: { -+ _36 = as Future>::poll(move _38, move _39) -> [return: bb98, unwind: bb85]; ++ bb66: { ++ _36 = as Future>::poll(move _38, move _39) -> [return: bb65, unwind: bb52]; + } + -+ bb100: { ++ bb67: { + _40 = move _2; -+ _39 = std::future::get_context::<'_, '_>(move _40) -> [return: bb99, unwind: bb85]; ++ _39 = std::future::get_context::<'_, '_>(move _40) -> [return: bb66, unwind: bb52]; + } + -+ bb101: { ++ bb68: { + _41 = &mut _27; -+ _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb100, unwind: bb85]; ++ _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb67, unwind: bb52]; + } + -+ bb102: { ++ bb69: { + StorageLive(_27); -+ _27 = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb101, unwind: bb85]; ++ _27 = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb68, unwind: bb52]; + } + -+ bb103: { ++ bb70: { + _43 = &mut _26; -+ _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb102, unwind: bb44]; ++ _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb69, unwind: bb26]; + } + -+ bb104: { ++ bb71: { + StorageDead(_44); -+ goto -> bb12; ++ goto -> bb3; + } + -+ bb105: { ++ bb72: { + StorageDead(_44); -+ goto -> bb25; ++ goto -> bb15; + } + -+ bb106 (cleanup): { ++ bb73 (cleanup): { + StorageDead(_44); -+ goto -> bb46; ++ goto -> bb27; + } + -+ bb107: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb107, unwind: bb106]; ++ bb74: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb74, unwind: bb73]; + } + -+ bb108: { ++ bb75: { + _2 = move _45; + StorageDead(_45); -+ goto -> bb107; ++ goto -> bb74; + } + -+ bb109: { ++ bb76: { + _2 = move _45; + StorageDead(_45); -+ goto -> bb114; ++ goto -> bb81; + } + -+ bb110: { ++ bb77: { + StorageLive(_45); -+ _45 = yield(const ()) -> [resume: bb108, drop: bb109]; ++ _45 = yield(const ()) -> [resume: bb75, drop: bb76]; + } + -+ bb111: { ++ bb78: { + _47 = discriminant(_46); -+ switchInt(move _47) -> [0: bb105, 1: bb110, otherwise: bb90]; ++ switchInt(move _47) -> [0: bb72, 1: bb77, otherwise: bb57]; + } + -+ bb112: { -+ _46 = as Future>::poll(move _48, move _49) -> [return: bb111, unwind: bb106]; ++ bb79: { ++ _46 = as Future>::poll(move _48, move _49) -> [return: bb78, unwind: bb73]; + } + -+ bb113: { ++ bb80: { + _50 = move _2; -+ _49 = std::future::get_context::<'_, '_>(move _50) -> [return: bb112, unwind: bb106]; ++ _49 = std::future::get_context::<'_, '_>(move _50) -> [return: bb79, unwind: bb73]; + } + -+ bb114: { ++ bb81: { + _51 = &mut _44; -+ _48 = Pin::<&mut impl Future>::new_unchecked(move _51) -> [return: bb113, unwind: bb106]; ++ _48 = Pin::<&mut impl Future>::new_unchecked(move _51) -> [return: bb80, unwind: bb73]; + } + -+ bb115: { ++ bb82: { + _2 = move _52; + StorageDead(_52); -+ goto -> bb121; ++ goto -> bb88; + } + -+ bb116: { ++ bb83: { + _2 = move _52; + StorageDead(_52); -+ goto -> bb114; ++ goto -> bb81; + } + -+ bb117: { ++ bb84: { + StorageLive(_52); -+ _52 = yield(const ()) -> [resume: bb115, drop: bb116]; ++ _52 = yield(const ()) -> [resume: bb82, drop: bb83]; + } + -+ bb118: { ++ bb85: { + _54 = discriminant(_53); -+ switchInt(move _54) -> [0: bb104, 1: bb117, otherwise: bb90]; ++ switchInt(move _54) -> [0: bb71, 1: bb84, otherwise: bb57]; + } + -+ bb119: { -+ _53 = as Future>::poll(move _55, move _56) -> [return: bb118, unwind: bb106]; ++ bb86: { ++ _53 = as Future>::poll(move _55, move _56) -> [return: bb85, unwind: bb73]; + } + -+ bb120: { ++ bb87: { + _57 = move _2; -+ _56 = std::future::get_context::<'_, '_>(move _57) -> [return: bb119, unwind: bb106]; ++ _56 = std::future::get_context::<'_, '_>(move _57) -> [return: bb86, unwind: bb73]; + } + -+ bb121: { ++ bb88: { + _58 = &mut _44; -+ _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb120, unwind: bb106]; ++ _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb87, unwind: bb73]; + } + -+ bb122: { ++ bb89: { + StorageLive(_44); -+ _44 = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb121, unwind: bb106]; ++ _44 = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb88, unwind: bb73]; + } + -+ bb123: { ++ bb90: { + _60 = &mut _24; -+ _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb122, unwind: bb46]; ++ _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb89, unwind: bb27]; + } + -+ bb124: { ++ bb91: { + StorageDead(_61); -+ goto -> bb14; ++ goto -> bb4; + } + -+ bb125: { ++ bb92: { + StorageDead(_61); -+ goto -> bb27; ++ goto -> bb17; + } + -+ bb126 (cleanup): { ++ bb93 (cleanup): { + StorageDead(_61); -+ goto -> bb48; ++ goto -> bb28; + } + -+ bb127: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb127, unwind: bb126]; ++ bb94: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb94, unwind: bb93]; + } + -+ bb128: { ++ bb95: { + _2 = move _62; + StorageDead(_62); -+ goto -> bb127; ++ goto -> bb94; + } + -+ bb129: { ++ bb96: { + _2 = move _62; + StorageDead(_62); -+ goto -> bb134; ++ goto -> bb101; + } + -+ bb130: { ++ bb97: { + StorageLive(_62); -+ _62 = yield(const ()) -> [resume: bb128, drop: bb129]; ++ _62 = yield(const ()) -> [resume: bb95, drop: bb96]; + } + -+ bb131: { ++ bb98: { + _64 = discriminant(_63); -+ switchInt(move _64) -> [0: bb125, 1: bb130, otherwise: bb90]; ++ switchInt(move _64) -> [0: bb92, 1: bb97, otherwise: bb57]; + } + -+ bb132: { -+ _63 = as Future>::poll(move _65, move _66) -> [return: bb131, unwind: bb126]; ++ bb99: { ++ _63 = as Future>::poll(move _65, move _66) -> [return: bb98, unwind: bb93]; + } + -+ bb133: { ++ bb100: { + _67 = move _2; -+ _66 = std::future::get_context::<'_, '_>(move _67) -> [return: bb132, unwind: bb126]; ++ _66 = std::future::get_context::<'_, '_>(move _67) -> [return: bb99, unwind: bb93]; + } + -+ bb134: { ++ bb101: { + _68 = &mut _61; -+ _65 = Pin::<&mut impl Future>::new_unchecked(move _68) -> [return: bb133, unwind: bb126]; ++ _65 = Pin::<&mut impl Future>::new_unchecked(move _68) -> [return: bb100, unwind: bb93]; + } + -+ bb135: { ++ bb102: { + _2 = move _69; + StorageDead(_69); -+ goto -> bb141; ++ goto -> bb108; + } + -+ bb136: { ++ bb103: { + _2 = move _69; + StorageDead(_69); -+ goto -> bb134; ++ goto -> bb101; + } + -+ bb137: { ++ bb104: { + StorageLive(_69); -+ _69 = yield(const ()) -> [resume: bb135, drop: bb136]; ++ _69 = yield(const ()) -> [resume: bb102, drop: bb103]; + } + -+ bb138: { ++ bb105: { + _71 = discriminant(_70); -+ switchInt(move _71) -> [0: bb124, 1: bb137, otherwise: bb90]; ++ switchInt(move _71) -> [0: bb91, 1: bb104, otherwise: bb57]; + } + -+ bb139: { -+ _70 = as Future>::poll(move _72, move _73) -> [return: bb138, unwind: bb126]; ++ bb106: { ++ _70 = as Future>::poll(move _72, move _73) -> [return: bb105, unwind: bb93]; + } + -+ bb140: { ++ bb107: { + _74 = move _2; -+ _73 = std::future::get_context::<'_, '_>(move _74) -> [return: bb139, unwind: bb126]; ++ _73 = std::future::get_context::<'_, '_>(move _74) -> [return: bb106, unwind: bb93]; + } + -+ bb141: { ++ bb108: { + _75 = &mut _61; -+ _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb140, unwind: bb126]; ++ _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb107, unwind: bb93]; + } + -+ bb142: { ++ bb109: { + StorageLive(_61); -+ _61 = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb141, unwind: bb126]; ++ _61 = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb108, unwind: bb93]; + } + -+ bb143: { ++ bb110: { + _77 = &mut _20; -+ _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb142, unwind: bb48]; ++ _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb109, unwind: bb28]; + } + -+ bb144: { ++ bb111: { + StorageDead(_78); -+ goto -> bb15; ++ goto -> bb5; + } + -+ bb145: { ++ bb112: { + StorageDead(_78); -+ goto -> bb28; ++ goto -> bb18; + } + -+ bb146 (cleanup): { ++ bb113 (cleanup): { + StorageDead(_78); -+ goto -> bb49; ++ goto -> bb29; + } + -+ bb147: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb147, unwind: bb146]; ++ bb114: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb114, unwind: bb113]; + } + -+ bb148: { ++ bb115: { + _2 = move _79; + StorageDead(_79); -+ goto -> bb147; ++ goto -> bb114; + } + -+ bb149: { ++ bb116: { + _2 = move _79; + StorageDead(_79); -+ goto -> bb154; ++ goto -> bb121; + } + -+ bb150: { ++ bb117: { + StorageLive(_79); -+ _79 = yield(const ()) -> [resume: bb148, drop: bb149]; ++ _79 = yield(const ()) -> [resume: bb115, drop: bb116]; + } + -+ bb151: { ++ bb118: { + _81 = discriminant(_80); -+ switchInt(move _81) -> [0: bb145, 1: bb150, otherwise: bb90]; ++ switchInt(move _81) -> [0: bb112, 1: bb117, otherwise: bb57]; + } + -+ bb152: { -+ _80 = as Future>::poll(move _82, move _83) -> [return: bb151, unwind: bb146]; ++ bb119: { ++ _80 = as Future>::poll(move _82, move _83) -> [return: bb118, unwind: bb113]; + } + -+ bb153: { ++ bb120: { + _84 = move _2; -+ _83 = std::future::get_context::<'_, '_>(move _84) -> [return: bb152, unwind: bb146]; ++ _83 = std::future::get_context::<'_, '_>(move _84) -> [return: bb119, unwind: bb113]; + } + -+ bb154: { ++ bb121: { + _85 = &mut _78; -+ _82 = Pin::<&mut impl Future>::new_unchecked(move _85) -> [return: bb153, unwind: bb146]; ++ _82 = Pin::<&mut impl Future>::new_unchecked(move _85) -> [return: bb120, unwind: bb113]; + } + -+ bb155: { ++ bb122: { + _2 = move _86; + StorageDead(_86); -+ goto -> bb161; ++ goto -> bb128; + } + -+ bb156: { ++ bb123: { + _2 = move _86; + StorageDead(_86); -+ goto -> bb154; ++ goto -> bb121; + } + -+ bb157: { ++ bb124: { + StorageLive(_86); -+ _86 = yield(const ()) -> [resume: bb155, drop: bb156]; ++ _86 = yield(const ()) -> [resume: bb122, drop: bb123]; + } + -+ bb158: { ++ bb125: { + _88 = discriminant(_87); -+ switchInt(move _88) -> [0: bb144, 1: bb157, otherwise: bb90]; ++ switchInt(move _88) -> [0: bb111, 1: bb124, otherwise: bb57]; + } + -+ bb159: { -+ _87 = as Future>::poll(move _89, move _90) -> [return: bb158, unwind: bb146]; ++ bb126: { ++ _87 = as Future>::poll(move _89, move _90) -> [return: bb125, unwind: bb113]; + } + -+ bb160: { ++ bb127: { + _91 = move _2; -+ _90 = std::future::get_context::<'_, '_>(move _91) -> [return: bb159, unwind: bb146]; ++ _90 = std::future::get_context::<'_, '_>(move _91) -> [return: bb126, unwind: bb113]; + } + -+ bb161: { ++ bb128: { + _92 = &mut _78; -+ _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb160, unwind: bb146]; ++ _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb127, unwind: bb113]; + } + -+ bb162: { ++ bb129: { + StorageLive(_78); -+ _78 = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb161, unwind: bb146]; ++ _78 = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb128, unwind: bb113]; + } + -+ bb163: { ++ bb130: { + _94 = &mut _19; -+ _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb162, unwind: bb49]; ++ _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb129, unwind: bb29]; + } + -+ bb164: { ++ bb131: { + StorageDead(_95); -+ goto -> bb16; ++ goto -> bb6; + } + -+ bb165: { ++ bb132: { + StorageDead(_95); -+ goto -> bb30; ++ goto -> bb19; + } + -+ bb166 (cleanup): { ++ bb133 (cleanup): { + StorageDead(_95); -+ goto -> bb54; ++ goto -> bb32; + } + -+ bb167: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb167, unwind: bb166]; ++ bb134: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb134, unwind: bb133]; + } + -+ bb168: { ++ bb135: { + _2 = move _96; + StorageDead(_96); -+ goto -> bb167; ++ goto -> bb134; + } + -+ bb169: { ++ bb136: { + _2 = move _96; + StorageDead(_96); -+ goto -> bb174; ++ goto -> bb141; + } + -+ bb170: { ++ bb137: { + StorageLive(_96); -+ _96 = yield(const ()) -> [resume: bb168, drop: bb169]; ++ _96 = yield(const ()) -> [resume: bb135, drop: bb136]; + } + -+ bb171: { ++ bb138: { + _98 = discriminant(_97); -+ switchInt(move _98) -> [0: bb165, 1: bb170, otherwise: bb90]; ++ switchInt(move _98) -> [0: bb132, 1: bb137, otherwise: bb57]; + } + -+ bb172: { -+ _97 = as Future>::poll(move _99, move _100) -> [return: bb171, unwind: bb166]; ++ bb139: { ++ _97 = as Future>::poll(move _99, move _100) -> [return: bb138, unwind: bb133]; + } + -+ bb173: { ++ bb140: { + _101 = move _2; -+ _100 = std::future::get_context::<'_, '_>(move _101) -> [return: bb172, unwind: bb166]; ++ _100 = std::future::get_context::<'_, '_>(move _101) -> [return: bb139, unwind: bb133]; + } + -+ bb174: { ++ bb141: { + _102 = &mut _95; -+ _99 = Pin::<&mut impl Future>::new_unchecked(move _102) -> [return: bb173, unwind: bb166]; ++ _99 = Pin::<&mut impl Future>::new_unchecked(move _102) -> [return: bb140, unwind: bb133]; + } + -+ bb175: { ++ bb142: { + _2 = move _103; + StorageDead(_103); -+ goto -> bb181; ++ goto -> bb148; + } + -+ bb176: { ++ bb143: { + _2 = move _103; + StorageDead(_103); -+ goto -> bb174; ++ goto -> bb141; + } + -+ bb177: { ++ bb144: { + StorageLive(_103); -+ _103 = yield(const ()) -> [resume: bb175, drop: bb176]; ++ _103 = yield(const ()) -> [resume: bb142, drop: bb143]; + } + -+ bb178: { ++ bb145: { + _105 = discriminant(_104); -+ switchInt(move _105) -> [0: bb164, 1: bb177, otherwise: bb90]; ++ switchInt(move _105) -> [0: bb131, 1: bb144, otherwise: bb57]; + } + -+ bb179: { -+ _104 = as Future>::poll(move _106, move _107) -> [return: bb178, unwind: bb166]; ++ bb146: { ++ _104 = as Future>::poll(move _106, move _107) -> [return: bb145, unwind: bb133]; + } + -+ bb180: { ++ bb147: { + _108 = move _2; -+ _107 = std::future::get_context::<'_, '_>(move _108) -> [return: bb179, unwind: bb166]; ++ _107 = std::future::get_context::<'_, '_>(move _108) -> [return: bb146, unwind: bb133]; + } + -+ bb181: { ++ bb148: { + _109 = &mut _95; -+ _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb180, unwind: bb166]; ++ _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb147, unwind: bb133]; + } + -+ bb182: { ++ bb149: { + StorageLive(_95); -+ _95 = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb181, unwind: bb166]; ++ _95 = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb148, unwind: bb133]; + } + -+ bb183: { ++ bb150: { + _111 = &mut _15; -+ _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb182, unwind: bb54]; ++ _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb149, unwind: bb32]; + } + -+ bb184: { ++ bb151: { + StorageDead(_112); -+ goto -> bb17; ++ goto -> bb7; + } + -+ bb185: { ++ bb152: { + StorageDead(_112); -+ goto -> bb34; ++ goto -> bb20; + } + -+ bb186 (cleanup): { ++ bb153 (cleanup): { + StorageDead(_112); -+ goto -> bb58; ++ goto -> bb33; + } + -+ bb187: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb187, unwind: bb186]; ++ bb154: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb154, unwind: bb153]; + } + -+ bb188: { ++ bb155: { + _2 = move _113; + StorageDead(_113); -+ goto -> bb187; ++ goto -> bb154; + } + -+ bb189: { ++ bb156: { + _2 = move _113; + StorageDead(_113); -+ goto -> bb194; ++ goto -> bb161; + } + -+ bb190: { ++ bb157: { + StorageLive(_113); -+ _113 = yield(const ()) -> [resume: bb188, drop: bb189]; ++ _113 = yield(const ()) -> [resume: bb155, drop: bb156]; + } + -+ bb191: { ++ bb158: { + _115 = discriminant(_114); -+ switchInt(move _115) -> [0: bb185, 1: bb190, otherwise: bb90]; ++ switchInt(move _115) -> [0: bb152, 1: bb157, otherwise: bb57]; + } + -+ bb192: { -+ _114 = as Future>::poll(move _116, move _117) -> [return: bb191, unwind: bb186]; ++ bb159: { ++ _114 = as Future>::poll(move _116, move _117) -> [return: bb158, unwind: bb153]; + } + -+ bb193: { ++ bb160: { + _118 = move _2; -+ _117 = std::future::get_context::<'_, '_>(move _118) -> [return: bb192, unwind: bb186]; ++ _117 = std::future::get_context::<'_, '_>(move _118) -> [return: bb159, unwind: bb153]; + } + -+ bb194: { ++ bb161: { + _119 = &mut _112; -+ _116 = Pin::<&mut impl Future>::new_unchecked(move _119) -> [return: bb193, unwind: bb186]; ++ _116 = Pin::<&mut impl Future>::new_unchecked(move _119) -> [return: bb160, unwind: bb153]; + } + -+ bb195: { ++ bb162: { + _2 = move _120; + StorageDead(_120); -+ goto -> bb201; ++ goto -> bb168; + } + -+ bb196: { ++ bb163: { + _2 = move _120; + StorageDead(_120); -+ goto -> bb194; ++ goto -> bb161; + } + -+ bb197: { ++ bb164: { + StorageLive(_120); -+ _120 = yield(const ()) -> [resume: bb195, drop: bb196]; ++ _120 = yield(const ()) -> [resume: bb162, drop: bb163]; + } + -+ bb198: { ++ bb165: { + _122 = discriminant(_121); -+ switchInt(move _122) -> [0: bb184, 1: bb197, otherwise: bb90]; ++ switchInt(move _122) -> [0: bb151, 1: bb164, otherwise: bb57]; + } + -+ bb199: { -+ _121 = as Future>::poll(move _123, move _124) -> [return: bb198, unwind: bb186]; ++ bb166: { ++ _121 = as Future>::poll(move _123, move _124) -> [return: bb165, unwind: bb153]; + } + -+ bb200: { ++ bb167: { + _125 = move _2; -+ _124 = std::future::get_context::<'_, '_>(move _125) -> [return: bb199, unwind: bb186]; ++ _124 = std::future::get_context::<'_, '_>(move _125) -> [return: bb166, unwind: bb153]; + } + -+ bb201: { ++ bb168: { + _126 = &mut _112; -+ _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb200, unwind: bb186]; ++ _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb167, unwind: bb153]; + } + -+ bb202: { ++ bb169: { + StorageLive(_112); -+ _112 = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb201, unwind: bb186]; ++ _112 = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb168, unwind: bb153]; + } + -+ bb203: { ++ bb170: { + _128 = &mut _11; -+ _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb202, unwind: bb58]; ++ _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb169, unwind: bb33]; + } + -+ bb204: { ++ bb171: { + StorageDead(_129); -+ goto -> bb18; ++ goto -> bb8; + } + -+ bb205: { ++ bb172: { + StorageDead(_129); -+ goto -> bb37; ++ goto -> bb21; + } + -+ bb206 (cleanup): { ++ bb173 (cleanup): { + StorageDead(_129); -+ goto -> bb61; ++ goto -> bb34; + } + -+ bb207: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb207, unwind: bb206]; ++ bb174: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb174, unwind: bb173]; + } + -+ bb208: { ++ bb175: { + _2 = move _130; + StorageDead(_130); -+ goto -> bb207; ++ goto -> bb174; + } + -+ bb209: { ++ bb176: { + _2 = move _130; + StorageDead(_130); -+ goto -> bb214; ++ goto -> bb181; + } + -+ bb210: { ++ bb177: { + StorageLive(_130); -+ _130 = yield(const ()) -> [resume: bb208, drop: bb209]; ++ _130 = yield(const ()) -> [resume: bb175, drop: bb176]; + } + -+ bb211: { ++ bb178: { + _132 = discriminant(_131); -+ switchInt(move _132) -> [0: bb205, 1: bb210, otherwise: bb90]; ++ switchInt(move _132) -> [0: bb172, 1: bb177, otherwise: bb57]; + } + -+ bb212: { -+ _131 = as Future>::poll(move _133, move _134) -> [return: bb211, unwind: bb206]; ++ bb179: { ++ _131 = as Future>::poll(move _133, move _134) -> [return: bb178, unwind: bb173]; + } + -+ bb213: { ++ bb180: { + _135 = move _2; -+ _134 = std::future::get_context::<'_, '_>(move _135) -> [return: bb212, unwind: bb206]; ++ _134 = std::future::get_context::<'_, '_>(move _135) -> [return: bb179, unwind: bb173]; + } + -+ bb214: { ++ bb181: { + _136 = &mut _129; -+ _133 = Pin::<&mut impl Future>::new_unchecked(move _136) -> [return: bb213, unwind: bb206]; ++ _133 = Pin::<&mut impl Future>::new_unchecked(move _136) -> [return: bb180, unwind: bb173]; + } + -+ bb215: { ++ bb182: { + _2 = move _137; + StorageDead(_137); -+ goto -> bb221; ++ goto -> bb188; + } + -+ bb216: { ++ bb183: { + _2 = move _137; + StorageDead(_137); -+ goto -> bb214; ++ goto -> bb181; + } + -+ bb217: { ++ bb184: { + StorageLive(_137); -+ _137 = yield(const ()) -> [resume: bb215, drop: bb216]; ++ _137 = yield(const ()) -> [resume: bb182, drop: bb183]; + } + -+ bb218: { ++ bb185: { + _139 = discriminant(_138); -+ switchInt(move _139) -> [0: bb204, 1: bb217, otherwise: bb90]; ++ switchInt(move _139) -> [0: bb171, 1: bb184, otherwise: bb57]; + } + -+ bb219: { -+ _138 = as Future>::poll(move _140, move _141) -> [return: bb218, unwind: bb206]; ++ bb186: { ++ _138 = as Future>::poll(move _140, move _141) -> [return: bb185, unwind: bb173]; + } + -+ bb220: { ++ bb187: { + _142 = move _2; -+ _141 = std::future::get_context::<'_, '_>(move _142) -> [return: bb219, unwind: bb206]; ++ _141 = std::future::get_context::<'_, '_>(move _142) -> [return: bb186, unwind: bb173]; + } + -+ bb221: { ++ bb188: { + _143 = &mut _129; -+ _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb220, unwind: bb206]; ++ _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb187, unwind: bb173]; + } + -+ bb222: { ++ bb189: { + StorageLive(_129); -+ _129 = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb221, unwind: bb206]; ++ _129 = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb188, unwind: bb173]; + } + -+ bb223: { ++ bb190: { + _145 = &mut _8; -+ _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb222, unwind: bb61]; ++ _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb189, unwind: bb34]; + } + -+ bb224: { ++ bb191: { + StorageDead(_146); -+ goto -> bb19; ++ goto -> bb9; + } + -+ bb225: { ++ bb192: { + StorageDead(_146); -+ goto -> bb40; ++ goto -> bb22; + } + -+ bb226 (cleanup): { ++ bb193 (cleanup): { + StorageDead(_146); -+ goto -> bb64; ++ goto -> bb35; + } + -+ bb227: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb227, unwind: bb226]; ++ bb194: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb194, unwind: bb193]; + } + -+ bb228: { ++ bb195: { + _2 = move _147; + StorageDead(_147); -+ goto -> bb227; ++ goto -> bb194; + } + -+ bb229: { ++ bb196: { + _2 = move _147; + StorageDead(_147); -+ goto -> bb234; ++ goto -> bb201; + } + -+ bb230: { ++ bb197: { + StorageLive(_147); -+ _147 = yield(const ()) -> [resume: bb228, drop: bb229]; ++ _147 = yield(const ()) -> [resume: bb195, drop: bb196]; + } + -+ bb231: { ++ bb198: { + _149 = discriminant(_148); -+ switchInt(move _149) -> [0: bb225, 1: bb230, otherwise: bb90]; ++ switchInt(move _149) -> [0: bb192, 1: bb197, otherwise: bb57]; + } + -+ bb232: { -+ _148 = as Future>::poll(move _150, move _151) -> [return: bb231, unwind: bb226]; ++ bb199: { ++ _148 = as Future>::poll(move _150, move _151) -> [return: bb198, unwind: bb193]; + } + -+ bb233: { ++ bb200: { + _152 = move _2; -+ _151 = std::future::get_context::<'_, '_>(move _152) -> [return: bb232, unwind: bb226]; ++ _151 = std::future::get_context::<'_, '_>(move _152) -> [return: bb199, unwind: bb193]; + } + -+ bb234: { ++ bb201: { + _153 = &mut _146; -+ _150 = Pin::<&mut impl Future>::new_unchecked(move _153) -> [return: bb233, unwind: bb226]; ++ _150 = Pin::<&mut impl Future>::new_unchecked(move _153) -> [return: bb200, unwind: bb193]; + } + -+ bb235: { ++ bb202: { + _2 = move _154; + StorageDead(_154); -+ goto -> bb241; ++ goto -> bb208; + } + -+ bb236: { ++ bb203: { + _2 = move _154; + StorageDead(_154); -+ goto -> bb234; ++ goto -> bb201; + } + -+ bb237: { ++ bb204: { + StorageLive(_154); -+ _154 = yield(const ()) -> [resume: bb235, drop: bb236]; ++ _154 = yield(const ()) -> [resume: bb202, drop: bb203]; + } + -+ bb238: { ++ bb205: { + _156 = discriminant(_155); -+ switchInt(move _156) -> [0: bb224, 1: bb237, otherwise: bb90]; ++ switchInt(move _156) -> [0: bb191, 1: bb204, otherwise: bb57]; + } + -+ bb239: { -+ _155 = as Future>::poll(move _157, move _158) -> [return: bb238, unwind: bb226]; ++ bb206: { ++ _155 = as Future>::poll(move _157, move _158) -> [return: bb205, unwind: bb193]; + } + -+ bb240: { ++ bb207: { + _159 = move _2; -+ _158 = std::future::get_context::<'_, '_>(move _159) -> [return: bb239, unwind: bb226]; ++ _158 = std::future::get_context::<'_, '_>(move _159) -> [return: bb206, unwind: bb193]; + } + -+ bb241: { ++ bb208: { + _160 = &mut _146; -+ _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb240, unwind: bb226]; ++ _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb207, unwind: bb193]; + } + -+ bb242: { ++ bb209: { + StorageLive(_146); -+ _146 = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb241, unwind: bb226]; ++ _146 = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb208, unwind: bb193]; + } + -+ bb243: { ++ bb210: { + _162 = &mut _5; -+ _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb242, unwind: bb64]; ++ _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb209, unwind: bb35]; + } + -+ bb244: { ++ bb211: { + StorageDead(_163); -+ goto -> bb20; ++ goto -> bb10; + } + -+ bb245: { ++ bb212: { + StorageDead(_163); -+ goto -> bb41; ++ goto -> bb23; + } + -+ bb246 (cleanup): { ++ bb213 (cleanup): { + StorageDead(_163); -+ goto -> bb65; ++ goto -> bb36; + } + -+ bb247: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb247, unwind: bb246]; ++ bb214: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb214, unwind: bb213]; + } + -+ bb248: { ++ bb215: { + _2 = move _164; + StorageDead(_164); -+ goto -> bb247; ++ goto -> bb214; + } + -+ bb249: { ++ bb216: { + _2 = move _164; + StorageDead(_164); -+ goto -> bb254; ++ goto -> bb221; + } + -+ bb250: { ++ bb217: { + StorageLive(_164); -+ _164 = yield(const ()) -> [resume: bb248, drop: bb249]; ++ _164 = yield(const ()) -> [resume: bb215, drop: bb216]; + } + -+ bb251: { ++ bb218: { + _166 = discriminant(_165); -+ switchInt(move _166) -> [0: bb245, 1: bb250, otherwise: bb90]; ++ switchInt(move _166) -> [0: bb212, 1: bb217, otherwise: bb57]; + } + -+ bb252: { -+ _165 = as Future>::poll(move _167, move _168) -> [return: bb251, unwind: bb246]; ++ bb219: { ++ _165 = as Future>::poll(move _167, move _168) -> [return: bb218, unwind: bb213]; + } + -+ bb253: { ++ bb220: { + _169 = move _2; -+ _168 = std::future::get_context::<'_, '_>(move _169) -> [return: bb252, unwind: bb246]; ++ _168 = std::future::get_context::<'_, '_>(move _169) -> [return: bb219, unwind: bb213]; + } + -+ bb254: { ++ bb221: { + _170 = &mut _163; -+ _167 = Pin::<&mut impl Future>::new_unchecked(move _170) -> [return: bb253, unwind: bb246]; ++ _167 = Pin::<&mut impl Future>::new_unchecked(move _170) -> [return: bb220, unwind: bb213]; + } + -+ bb255: { ++ bb222: { + _2 = move _171; + StorageDead(_171); -+ goto -> bb261; ++ goto -> bb228; + } + -+ bb256: { ++ bb223: { + _2 = move _171; + StorageDead(_171); -+ goto -> bb254; ++ goto -> bb221; + } + -+ bb257: { ++ bb224: { + StorageLive(_171); -+ _171 = yield(const ()) -> [resume: bb255, drop: bb256]; ++ _171 = yield(const ()) -> [resume: bb222, drop: bb223]; + } + -+ bb258: { ++ bb225: { + _173 = discriminant(_172); -+ switchInt(move _173) -> [0: bb244, 1: bb257, otherwise: bb90]; ++ switchInt(move _173) -> [0: bb211, 1: bb224, otherwise: bb57]; + } + -+ bb259: { -+ _172 = as Future>::poll(move _174, move _175) -> [return: bb258, unwind: bb246]; ++ bb226: { ++ _172 = as Future>::poll(move _174, move _175) -> [return: bb225, unwind: bb213]; + } + -+ bb260: { ++ bb227: { + _176 = move _2; -+ _175 = std::future::get_context::<'_, '_>(move _176) -> [return: bb259, unwind: bb246]; ++ _175 = std::future::get_context::<'_, '_>(move _176) -> [return: bb226, unwind: bb213]; + } + -+ bb261: { ++ bb228: { + _177 = &mut _163; -+ _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb260, unwind: bb246]; ++ _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb227, unwind: bb213]; + } + -+ bb262: { ++ bb229: { + StorageLive(_163); -+ _163 = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb261, unwind: bb246]; ++ _163 = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb228, unwind: bb213]; + } + -+ bb263: { ++ bb230: { + _179 = &mut _4; -+ _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb262, unwind: bb65]; ++ _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb229, unwind: bb36]; } } diff --git a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.StateTransform.diff index 08e9ff5c2796f..f942412536f6c 100644 --- a/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_drop.elaborate_drops-{closure#0}.StateTransform.diff @@ -308,83 +308,44 @@ - StorageLive(_7); - _7 = AsyncInt(const 2_i32); - _5 = [move _6, move _7]; -- goto -> bb1; -+ _184 = move _2 as std::ptr::NonNull> (Transmute); -+ _183 = std::future::ResumeTy(move _184); -+ _182 = copy (_1.0: &mut {async fn body of elaborate_drops()}); -+ _181 = discriminant((*_182)); -+ switchInt(move _181) -> [0: bb169, 1: bb168, 2: bb167, 3: bb149, 4: bb150, 5: bb151, 6: bb152, 7: bb153, 8: bb154, 9: bb155, 10: bb156, 11: bb157, 12: bb158, 13: bb159, 14: bb160, 15: bb161, 16: bb162, 17: bb163, 18: bb164, 19: bb165, 20: bb166, otherwise: bb43]; - } - - bb1: { - StorageDead(_7); - goto -> bb2; - } - - bb2: { - StorageDead(_6); +- StorageDead(_7); +- StorageDead(_6); - StorageLive(_8); -+ nop; - StorageLive(_9); - _9 = AsyncInt(const 5_i32); - StorageLive(_10); - _10 = AsyncInt(const 4_i32); +- StorageLive(_9); +- _9 = AsyncInt(const 5_i32); +- StorageLive(_10); +- _10 = AsyncInt(const 4_i32); - _8 = AsyncStruct { i: const 3_i32, a: move _10, b: move _9 }; -+ (((*_182) as variant#16).4: AsyncStruct) = AsyncStruct { i: const 3_i32, a: move _10, b: move _9 }; - goto -> bb3; - } - - bb3: { - StorageDead(_10); - goto -> bb4; - } - - bb4: { - StorageDead(_9); +- StorageDead(_10); +- StorageDead(_9); - StorageLive(_11); -+ nop; - StorageLive(_12); - _12 = AsyncInt(const 7_i32); - StorageLive(_13); - _13 = SyncInt(const 8_i32); - StorageLive(_14); - _14 = AsyncInt(const 9_i32); +- StorageLive(_12); +- _12 = AsyncInt(const 7_i32); +- StorageLive(_13); +- _13 = SyncInt(const 8_i32); +- StorageLive(_14); +- _14 = AsyncInt(const 9_i32); - _11 = SyncThenAsync { i: const 6_i32, a: move _12, b: move _13, c: move _14 }; -+ (((*_182) as variant#14).5: SyncThenAsync) = SyncThenAsync { i: const 6_i32, a: move _12, b: move _13, c: move _14 }; - goto -> bb5; - } - - bb5: { - StorageDead(_14); - goto -> bb6; - } - - bb6: { - StorageDead(_13); - goto -> bb7; - } - - bb7: { - StorageDead(_12); +- StorageDead(_14); +- StorageDead(_13); +- StorageDead(_12); - StorageLive(_15); -+ nop; - StorageLive(_16); - _16 = AsyncInt(const 10_i32); +- StorageLive(_16); +- _16 = AsyncInt(const 10_i32); - _15 = AsyncEnum::A(move _16); -+ (((*_182) as variant#12).6: AsyncEnum) = AsyncEnum::A(move _16); - goto -> bb8; - } - - bb8: { - StorageDead(_16); - StorageLive(_17); - StorageLive(_18); - _18 = AsyncInt(const 11_i32); -- _17 = ManuallyDrop::::new(move _18) -> [return: bb9, unwind: bb42]; -+ _17 = ManuallyDrop::::new(move _18) -> [return: bb9, unwind: bb29]; +- StorageDead(_16); +- StorageLive(_17); +- StorageLive(_18); +- _18 = AsyncInt(const 11_i32); +- _17 = ManuallyDrop::::new(move _18) -> [return: bb1, unwind: bb30]; ++ _184 = move _2 as std::ptr::NonNull> (Transmute); ++ _183 = std::future::ResumeTy(move _184); ++ _182 = copy (_1.0: &mut {async fn body of elaborate_drops()}); ++ _181 = discriminant((*_182)); ++ switchInt(move _181) -> [0: bb156, 1: bb155, 2: bb154, 3: bb136, 4: bb137, 5: bb138, 6: bb139, 7: bb140, 8: bb141, 9: bb142, 10: bb143, 11: bb144, 12: bb145, 13: bb146, 14: bb147, 15: bb148, 16: bb149, 17: bb150, 18: bb151, 19: bb152, 20: bb153, otherwise: bb30]; } - bb9: { + bb1: { StorageDead(_18); - StorageLive(_19); - _19 = AsyncInt(const 12_i32); @@ -412,267 +373,247 @@ - StorageLive(_26); - _26 = {closure@$DIR/async_drop.rs:86:27: 86:35} { foo: move _25 }; - _0 = const (); -- goto -> bb72; +- goto -> bb59; + nop; + (((*_182) as variant#4).10: {async closure@$DIR/async_drop.rs:86:27: 86:35}) = {closure@$DIR/async_drop.rs:86:27: 86:35} { foo: move _25 }; + (((*_182) as variant#20).0: ()) = const (); -+ goto -> bb51; ++ goto -> bb38; } - bb10: { + bb2: { - StorageDead(_26); + nop; - goto -> bb11; - } - - bb11: { StorageDead(_25); -- goto -> bb92; -+ goto -> bb63; +- goto -> bb79; ++ goto -> bb50; } - bb12: { + bb3: { - StorageDead(_24); + nop; - goto -> bb13; - } - - bb13: { StorageDead(_23); -- goto -> bb112; -+ goto -> bb75; +- goto -> bb99; ++ goto -> bb62; } - bb14: { + bb4: { - StorageDead(_20); -- goto -> bb132; +- goto -> bb119; + nop; -+ goto -> bb87; ++ goto -> bb74; } - bb15: { + bb5: { - StorageDead(_19); + nop; StorageDead(_17); -- goto -> bb152; -+ goto -> bb99; +- goto -> bb139; ++ goto -> bb86; } - bb16: { + bb6: { - StorageDead(_15); -- goto -> bb172; +- goto -> bb159; + nop; -+ goto -> bb111; ++ goto -> bb98; } - bb17: { + bb7: { - StorageDead(_11); -- goto -> bb192; +- goto -> bb179; + nop; -+ goto -> bb123; ++ goto -> bb110; } - bb18: { + bb8: { - StorageDead(_8); -- goto -> bb212; +- goto -> bb199; + nop; -+ goto -> bb135; ++ goto -> bb122; } - bb19: { + bb9: { - StorageDead(_5); -- goto -> bb232; +- goto -> bb219; + nop; -+ goto -> bb147; ++ goto -> bb134; } - bb20: { + bb10: { - StorageDead(_4); -- drop(_3) -> [return: bb21, unwind: bb50]; +- drop(_3) -> [return: bb11, unwind: bb37]; + nop; -+ drop((((*_182) as variant#20).1: SyncInt)) -> [return: bb21, unwind: bb37]; ++ drop((((*_182) as variant#20).1: SyncInt)) -> [return: bb11, unwind: bb24]; } - bb21: { + bb11: { - StorageDead(_3); -- drop(_1) -> [return: bb22, unwind: bb51]; +- drop(_1) -> [return: bb12, unwind: bb38]; + nop; -+ goto -> bb22; ++ goto -> bb12; } - bb22: { + bb12: { + _0 = Poll::<()>::Ready(move (((*_182) as variant#20).0: ())); + discriminant((*_182)) = 1; return; } -- bb23: { +- bb13: { - StorageDead(_26); -+ bb23 (cleanup): { +- goto -> bb14; ++ bb13 (cleanup): { + nop; - goto -> bb24; ++ StorageDead(_25); ++ drop((((*_182) as variant#6).9: {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb14, unwind terminate(cleanup)]; } -- bb24: { -+ bb24 (cleanup): { - StorageDead(_25); -- goto -> bb25; -+ drop((((*_182) as variant#6).9: {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb25, unwind terminate(cleanup)]; +- bb14: { +- StorageDead(_25); +- goto -> bb15; ++ bb14 (cleanup): { ++ nop; ++ StorageDead(_23); ++ drop((((*_182) as variant#8).8: AsyncReference<'_>)) -> [return: bb15, unwind terminate(cleanup)]; } -- bb25: { +- bb15: { - StorageDead(_24); -+ bb25 (cleanup): { +- goto -> bb16; ++ bb15 (cleanup): { + nop; - goto -> bb26; ++ drop((((*_182) as variant#10).7: AsyncInt)) -> [return: bb16, unwind terminate(cleanup)]; } -- bb26: { -+ bb26 (cleanup): { - StorageDead(_23); -- goto -> bb27; -+ drop((((*_182) as variant#8).8: AsyncReference<'_>)) -> [return: bb27, unwind terminate(cleanup)]; +- bb16: { +- StorageDead(_23); +- goto -> bb17; ++ bb16 (cleanup): { ++ nop; ++ goto -> bb18; } -- bb27: { +- bb17: { - StorageDead(_20); -- goto -> bb28; -+ bb27 (cleanup): { -+ nop; -+ drop((((*_182) as variant#10).7: AsyncInt)) -> [return: bb28, unwind terminate(cleanup)]; ++ bb17 (cleanup): { ++ StorageDead(_18); + goto -> bb18; } -- bb28: { +- bb18: { - StorageDead(_19); -- StorageDead(_17); -- goto -> bb29; -+ bb28 (cleanup): { -+ nop; -+ goto -> bb31; ++ bb18 (cleanup): { + StorageDead(_17); +- goto -> bb19; ++ drop((((*_182) as variant#12).6: AsyncEnum)) -> [return: bb19, unwind terminate(cleanup)]; } -- bb29: { +- bb19: { - StorageDead(_15); -+ bb29 (cleanup): { - goto -> bb30; +- goto -> bb20; ++ bb19 (cleanup): { ++ nop; ++ drop((((*_182) as variant#14).5: SyncThenAsync)) -> [return: bb20, unwind terminate(cleanup)]; } -- bb30: { +- bb20: { - StorageDead(_11); -+ bb30 (cleanup): { -+ StorageDead(_18); - goto -> bb31; +- goto -> bb21; ++ bb20 (cleanup): { ++ nop; ++ drop((((*_182) as variant#16).4: AsyncStruct)) -> [return: bb21, unwind terminate(cleanup)]; } -- bb31: { +- bb21: { - StorageDead(_8); -- goto -> bb32; -+ bb31 (cleanup): { -+ StorageDead(_17); -+ drop((((*_182) as variant#12).6: AsyncEnum)) -> [return: bb32, unwind terminate(cleanup)]; +- goto -> bb22; ++ bb21 (cleanup): { ++ nop; ++ drop((((*_182) as variant#18).3: [AsyncInt; 2])) -> [return: bb22, unwind terminate(cleanup)]; } -- bb32: { +- bb22: { - StorageDead(_5); -- goto -> bb33; -+ bb32 (cleanup): { +- goto -> bb23; ++ bb22 (cleanup): { + nop; -+ drop((((*_182) as variant#14).5: SyncThenAsync)) -> [return: bb33, unwind terminate(cleanup)]; ++ drop((((*_182) as variant#20).2: AsyncInt)) -> [return: bb23, unwind terminate(cleanup)]; } -- bb33: { +- bb23: { - StorageDead(_4); -- goto -> bb34; -+ bb33 (cleanup): { +- goto -> bb24; ++ bb23 (cleanup): { + nop; -+ drop((((*_182) as variant#16).4: AsyncStruct)) -> [return: bb34, unwind terminate(cleanup)]; ++ drop((((*_182) as variant#20).1: SyncInt)) -> [return: bb24, unwind terminate(cleanup)]; } -- bb34: { +- bb24: { - StorageDead(_3); -- goto -> bb35; -+ bb34 (cleanup): { ++ bb24 (cleanup): { + nop; -+ drop((((*_182) as variant#18).3: [AsyncInt; 2])) -> [return: bb35, unwind terminate(cleanup)]; + goto -> bb25; } -- bb35: { +- bb25: { - coroutine_drop; -+ bb35 (cleanup): { -+ nop; -+ drop((((*_182) as variant#20).2: AsyncInt)) -> [return: bb36, unwind terminate(cleanup)]; ++ bb25 (cleanup): { ++ goto -> bb135; } - bb36 (cleanup): { +- bb26 (cleanup): { - StorageDead(_26); -- goto -> bb37; -+ nop; -+ drop((((*_182) as variant#20).1: SyncInt)) -> [return: bb37, unwind terminate(cleanup)]; - } - - bb37 (cleanup): { - StorageDead(_25); -- drop(_24) -> [return: bb38, unwind terminate(cleanup)]; +- drop(_24) -> [return: bb27, unwind terminate(cleanup)]; ++ bb26: { + nop; -+ goto -> bb38; ++ goto -> bb2; } - bb38 (cleanup): { + bb27 (cleanup): { - StorageDead(_24); -- goto -> bb39; -+ goto -> bb148; - } - -- bb39 (cleanup): { - StorageDead(_23); -- drop(_20) -> [return: bb40, unwind terminate(cleanup)]; -+ bb39: { +- drop(_20) -> [return: bb28, unwind terminate(cleanup)]; + nop; -+ goto -> bb10; ++ goto -> bb13; } - bb40 (cleanup): { +- bb28 (cleanup): { - StorageDead(_20); -- drop(_19) -> [return: bb41, unwind terminate(cleanup)]; -+ nop; -+ goto -> bb23; +- drop(_19) -> [return: bb29, unwind terminate(cleanup)]; ++ bb28: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb28, unwind: bb27]; } -- bb41 (cleanup): { +- bb29 (cleanup): { - StorageDead(_19); -- goto -> bb44; -+ bb41: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb41, unwind: bb40]; - } - -- bb42 (cleanup): { -- goto -> bb43; -+ bb42: { +- goto -> bb31; ++ bb29: { + _183 = move _28; + StorageDead(_28); -+ goto -> bb41; ++ goto -> bb28; } -- bb43 (cleanup): { +- bb30 (cleanup): { - StorageDead(_18); -- goto -> bb44; -+ bb43: { +- goto -> bb31; ++ bb30: { + unreachable; } -- bb44 (cleanup): { +- bb31 (cleanup): { - StorageDead(_17); -- drop(_15) -> [return: bb45, unwind terminate(cleanup)]; -+ bb44: { +- drop(_15) -> [return: bb32, unwind terminate(cleanup)]; ++ bb31: { + _183 = move _35; + StorageDead(_35); -+ goto -> bb49; ++ goto -> bb36; } -- bb45 (cleanup): { +- bb32 (cleanup): { - StorageDead(_15); -- drop(_11) -> [return: bb46, unwind terminate(cleanup)]; -+ bb45: { +- drop(_11) -> [return: bb33, unwind terminate(cleanup)]; ++ bb32: { + StorageLive(_35); + _0 = Poll::<()>::Pending; + StorageDead(_17); @@ -683,95 +624,95 @@ + return; } -- bb46 (cleanup): { +- bb33 (cleanup): { - StorageDead(_11); -- drop(_8) -> [return: bb47, unwind terminate(cleanup)]; -+ bb46: { +- drop(_8) -> [return: bb34, unwind terminate(cleanup)]; ++ bb33: { + _37 = discriminant(_36); -+ switchInt(move _37) -> [0: bb39, 1: bb45, otherwise: bb43]; ++ switchInt(move _37) -> [0: bb26, 1: bb32, otherwise: bb30]; } -- bb47 (cleanup): { +- bb34 (cleanup): { - StorageDead(_8); -- drop(_5) -> [return: bb48, unwind terminate(cleanup)]; -+ bb47: { -+ _36 = as Future>::poll(move _38, move _39) -> [return: bb46, unwind: bb40]; +- drop(_5) -> [return: bb35, unwind terminate(cleanup)]; ++ bb34: { ++ _36 = as Future>::poll(move _38, move _39) -> [return: bb33, unwind: bb27]; } -- bb48 (cleanup): { +- bb35 (cleanup): { - StorageDead(_5); -- drop(_4) -> [return: bb49, unwind terminate(cleanup)]; -+ bb48: { +- drop(_4) -> [return: bb36, unwind terminate(cleanup)]; ++ bb35: { + _40 = move _183; + _39 = copy (_40.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb47; ++ goto -> bb34; } -- bb49 (cleanup): { +- bb36 (cleanup): { - StorageDead(_4); -- drop(_3) -> [return: bb50, unwind terminate(cleanup)]; -+ bb49: { +- drop(_3) -> [return: bb37, unwind terminate(cleanup)]; ++ bb36: { + _41 = &mut (((*_182) as variant#4).11: impl std::future::Future); -+ _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb48, unwind: bb40]; ++ _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb35, unwind: bb27]; } -- bb50 (cleanup): { +- bb37 (cleanup): { - StorageDead(_3); -- drop(_1) -> [return: bb51, unwind terminate(cleanup)]; -+ bb50: { +- drop(_1) -> [return: bb38, unwind terminate(cleanup)]; ++ bb37: { + nop; -+ (((*_182) as variant#4).11: impl std::future::Future) = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb49, unwind: bb40]; ++ (((*_182) as variant#4).11: impl std::future::Future) = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb36, unwind: bb27]; } -- bb51 (cleanup): { +- bb38 (cleanup): { - resume; -+ bb51: { ++ bb38: { + _43 = &mut (((*_182) as variant#4).10: {async closure@$DIR/async_drop.rs:86:27: 86:35}); -+ _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb50, unwind: bb23]; ++ _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb37, unwind: bb13]; } - bb52: { + bb39: { - StorageDead(_27); -- goto -> bb10; +- goto -> bb2; + nop; -+ goto -> bb12; ++ goto -> bb3; } -- bb53: { +- bb40: { - StorageDead(_27); -- goto -> bb23; -+ bb53 (cleanup): { +- goto -> bb13; ++ bb40 (cleanup): { + nop; -+ goto -> bb25; ++ goto -> bb14; } -- bb54 (cleanup): { +- bb41 (cleanup): { - StorageDead(_27); -- goto -> bb36; -+ bb54: { -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb54, unwind: bb53]; +- goto -> bb26; ++ bb41: { ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb41, unwind: bb40]; } - bb55: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb55, unwind: bb54]; + bb42: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb42, unwind: bb41]; + _183 = move _45; + StorageDead(_45); -+ goto -> bb54; ++ goto -> bb41; } - bb56: { + bb43: { - _2 = move _28; - StorageDead(_28); -- goto -> bb55; +- goto -> bb42; + _183 = move _52; + StorageDead(_52); -+ goto -> bb61; ++ goto -> bb48; } - bb57: { + bb44: { - _2 = move _28; - StorageDead(_28); -- goto -> bb63; +- goto -> bb50; + StorageLive(_52); + _0 = Poll::<()>::Pending; + StorageDead(_17); @@ -781,87 +722,87 @@ + return; } - bb58: { + bb45: { - StorageLive(_28); -- _28 = yield(const ()) -> [resume: bb56, drop: bb57]; +- _28 = yield(const ()) -> [resume: bb43, drop: bb44]; + _54 = discriminant(_53); -+ switchInt(move _54) -> [0: bb52, 1: bb57, otherwise: bb43]; ++ switchInt(move _54) -> [0: bb39, 1: bb44, otherwise: bb30]; } - bb59: { + bb46: { - unreachable; -+ _53 = as Future>::poll(move _55, move _56) -> [return: bb58, unwind: bb53]; ++ _53 = as Future>::poll(move _55, move _56) -> [return: bb45, unwind: bb40]; } - bb60: { + bb47: { - _30 = discriminant(_29); -- switchInt(move _30) -> [0: bb53, 1: bb58, otherwise: bb59]; +- switchInt(move _30) -> [0: bb40, 1: bb45, otherwise: bb46]; + _57 = move _183; + _56 = copy (_57.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb59; ++ goto -> bb46; } - bb61: { -- _29 = as Future>::poll(move _31, move _32) -> [return: bb60, unwind: bb54]; + bb48: { +- _29 = as Future>::poll(move _31, move _32) -> [return: bb47, unwind: bb41]; + _58 = &mut (((*_182) as variant#6).10: impl std::future::Future); -+ _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb60, unwind: bb53]; ++ _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb47, unwind: bb40]; } - bb62: { + bb49: { - _33 = move _2; -- _32 = std::future::get_context::<'_, '_>(move _33) -> [return: bb61, unwind: bb54]; +- _32 = std::future::get_context::<'_, '_>(move _33) -> [return: bb48, unwind: bb41]; + nop; -+ (((*_182) as variant#6).10: impl std::future::Future) = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb61, unwind: bb53]; ++ (((*_182) as variant#6).10: impl std::future::Future) = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb48, unwind: bb40]; } - bb63: { + bb50: { - _34 = &mut _27; -- _31 = Pin::<&mut impl Future>::new_unchecked(move _34) -> [return: bb62, unwind: bb54]; +- _31 = Pin::<&mut impl Future>::new_unchecked(move _34) -> [return: bb49, unwind: bb41]; + _60 = &mut (((*_182) as variant#6).9: {closure@$DIR/async_drop.rs:78:25: 78:27}); -+ _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb62, unwind: bb25]; ++ _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb49, unwind: bb14]; } - bb64: { + bb51: { - _2 = move _35; - StorageDead(_35); -- goto -> bb70; +- goto -> bb57; + nop; -+ goto -> bb14; ++ goto -> bb4; } -- bb65: { +- bb52: { - _2 = move _35; - StorageDead(_35); -- goto -> bb63; -+ bb65 (cleanup): { +- goto -> bb50; ++ bb52 (cleanup): { + nop; -+ goto -> bb27; ++ goto -> bb15; } - bb66: { + bb53: { - StorageLive(_35); -- _35 = yield(const ()) -> [resume: bb64, drop: bb65]; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb66, unwind: bb65]; +- _35 = yield(const ()) -> [resume: bb51, drop: bb52]; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb53, unwind: bb52]; } - bb67: { + bb54: { - _37 = discriminant(_36); -- switchInt(move _37) -> [0: bb52, 1: bb66, otherwise: bb59]; +- switchInt(move _37) -> [0: bb39, 1: bb53, otherwise: bb46]; + _183 = move _62; + StorageDead(_62); -+ goto -> bb66; ++ goto -> bb53; } - bb68: { -- _36 = as Future>::poll(move _38, move _39) -> [return: bb67, unwind: bb54]; + bb55: { +- _36 = as Future>::poll(move _38, move _39) -> [return: bb54, unwind: bb41]; + _183 = move _69; + StorageDead(_69); -+ goto -> bb73; ++ goto -> bb60; } - bb69: { + bb56: { - _40 = move _2; -- _39 = std::future::get_context::<'_, '_>(move _40) -> [return: bb68, unwind: bb54]; +- _39 = std::future::get_context::<'_, '_>(move _40) -> [return: bb55, unwind: bb41]; + StorageLive(_69); + _0 = Poll::<()>::Pending; + StorageDead(_17); @@ -870,89 +811,89 @@ + return; } - bb70: { + bb57: { - _41 = &mut _27; -- _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb69, unwind: bb54]; +- _38 = Pin::<&mut impl Future>::new_unchecked(move _41) -> [return: bb56, unwind: bb41]; + _71 = discriminant(_70); -+ switchInt(move _71) -> [0: bb64, 1: bb69, otherwise: bb43]; ++ switchInt(move _71) -> [0: bb51, 1: bb56, otherwise: bb30]; } - bb71: { + bb58: { - StorageLive(_27); -- _27 = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb70, unwind: bb54]; -+ _70 = as Future>::poll(move _72, move _73) -> [return: bb70, unwind: bb65]; +- _27 = async_drop_in_place::<{async closure@$DIR/async_drop.rs:86:27: 86:35}>(copy (_42.0: &mut {async closure@$DIR/async_drop.rs:86:27: 86:35})) -> [return: bb57, unwind: bb41]; ++ _70 = as Future>::poll(move _72, move _73) -> [return: bb57, unwind: bb52]; } - bb72: { + bb59: { - _43 = &mut _26; -- _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb71, unwind: bb36]; +- _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:86:27: 86:35}>::new_unchecked(move _43) -> [return: bb58, unwind: bb26]; + _74 = move _183; + _73 = copy (_74.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb71; ++ goto -> bb58; } - bb73: { + bb60: { - StorageDead(_44); -- goto -> bb12; +- goto -> bb3; + _75 = &mut (((*_182) as variant#8).9: impl std::future::Future); -+ _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb72, unwind: bb65]; ++ _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb59, unwind: bb52]; } - bb74: { + bb61: { - StorageDead(_44); -- goto -> bb25; +- goto -> bb15; + nop; -+ (((*_182) as variant#8).9: impl std::future::Future) = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb73, unwind: bb65]; ++ (((*_182) as variant#8).9: impl std::future::Future) = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb60, unwind: bb52]; } -- bb75 (cleanup): { +- bb62 (cleanup): { - StorageDead(_44); -- goto -> bb38; -+ bb75: { +- goto -> bb27; ++ bb62: { + _77 = &mut (((*_182) as variant#8).8: AsyncReference<'_>); -+ _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb74, unwind: bb27]; ++ _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb61, unwind: bb15]; } - bb76: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb76, unwind: bb75]; + bb63: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb63, unwind: bb62]; + nop; -+ goto -> bb15; ++ goto -> bb5; } -- bb77: { +- bb64: { - _2 = move _45; - StorageDead(_45); -- goto -> bb76; -+ bb77 (cleanup): { +- goto -> bb63; ++ bb64 (cleanup): { + nop; -+ goto -> bb28; ++ goto -> bb16; } - bb78: { + bb65: { - _2 = move _45; - StorageDead(_45); -- goto -> bb83; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb78, unwind: bb77]; +- goto -> bb70; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb65, unwind: bb64]; } - bb79: { + bb66: { - StorageLive(_45); -- _45 = yield(const ()) -> [resume: bb77, drop: bb78]; +- _45 = yield(const ()) -> [resume: bb64, drop: bb65]; + _183 = move _79; + StorageDead(_79); -+ goto -> bb78; ++ goto -> bb65; } - bb80: { + bb67: { - _47 = discriminant(_46); -- switchInt(move _47) -> [0: bb74, 1: bb79, otherwise: bb59]; +- switchInt(move _47) -> [0: bb61, 1: bb66, otherwise: bb46]; + _183 = move _86; + StorageDead(_86); -+ goto -> bb85; ++ goto -> bb72; } - bb81: { -- _46 = as Future>::poll(move _48, move _49) -> [return: bb80, unwind: bb75]; + bb68: { +- _46 = as Future>::poll(move _48, move _49) -> [return: bb67, unwind: bb62]; + StorageLive(_86); + _0 = Poll::<()>::Pending; + StorageDead(_17); @@ -961,89 +902,89 @@ + return; } - bb82: { + bb69: { - _50 = move _2; -- _49 = std::future::get_context::<'_, '_>(move _50) -> [return: bb81, unwind: bb75]; +- _49 = std::future::get_context::<'_, '_>(move _50) -> [return: bb68, unwind: bb62]; + _88 = discriminant(_87); -+ switchInt(move _88) -> [0: bb76, 1: bb81, otherwise: bb43]; ++ switchInt(move _88) -> [0: bb63, 1: bb68, otherwise: bb30]; } - bb83: { + bb70: { - _51 = &mut _44; -- _48 = Pin::<&mut impl Future>::new_unchecked(move _51) -> [return: bb82, unwind: bb75]; -+ _87 = as Future>::poll(move _89, move _90) -> [return: bb82, unwind: bb77]; +- _48 = Pin::<&mut impl Future>::new_unchecked(move _51) -> [return: bb69, unwind: bb62]; ++ _87 = as Future>::poll(move _89, move _90) -> [return: bb69, unwind: bb64]; } - bb84: { + bb71: { - _2 = move _52; - StorageDead(_52); -- goto -> bb90; +- goto -> bb77; + _91 = move _183; + _90 = copy (_91.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb83; ++ goto -> bb70; } - bb85: { + bb72: { - _2 = move _52; - StorageDead(_52); -- goto -> bb83; +- goto -> bb70; + _92 = &mut (((*_182) as variant#10).8: impl std::future::Future); -+ _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb84, unwind: bb77]; ++ _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb71, unwind: bb64]; } - bb86: { + bb73: { - StorageLive(_52); -- _52 = yield(const ()) -> [resume: bb84, drop: bb85]; +- _52 = yield(const ()) -> [resume: bb71, drop: bb72]; + nop; -+ (((*_182) as variant#10).8: impl std::future::Future) = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb85, unwind: bb77]; ++ (((*_182) as variant#10).8: impl std::future::Future) = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb72, unwind: bb64]; } - bb87: { + bb74: { - _54 = discriminant(_53); -- switchInt(move _54) -> [0: bb73, 1: bb86, otherwise: bb59]; +- switchInt(move _54) -> [0: bb60, 1: bb73, otherwise: bb46]; + _94 = &mut (((*_182) as variant#10).7: AsyncInt); -+ _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb86, unwind: bb28]; ++ _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb73, unwind: bb16]; } - bb88: { -- _53 = as Future>::poll(move _55, move _56) -> [return: bb87, unwind: bb75]; + bb75: { +- _53 = as Future>::poll(move _55, move _56) -> [return: bb74, unwind: bb62]; + nop; -+ goto -> bb16; ++ goto -> bb6; } -- bb89: { +- bb76: { - _57 = move _2; -- _56 = std::future::get_context::<'_, '_>(move _57) -> [return: bb88, unwind: bb75]; -+ bb89 (cleanup): { +- _56 = std::future::get_context::<'_, '_>(move _57) -> [return: bb75, unwind: bb62]; ++ bb76 (cleanup): { + nop; -+ goto -> bb32; ++ goto -> bb19; } - bb90: { + bb77: { - _58 = &mut _44; -- _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb89, unwind: bb75]; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb90, unwind: bb89]; +- _55 = Pin::<&mut impl Future>::new_unchecked(move _58) -> [return: bb76, unwind: bb62]; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb77, unwind: bb76]; } - bb91: { + bb78: { - StorageLive(_44); -- _44 = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb90, unwind: bb75]; +- _44 = async_drop_in_place::<{closure@$DIR/async_drop.rs:78:25: 78:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:78:25: 78:27})) -> [return: bb77, unwind: bb62]; + _183 = move _96; + StorageDead(_96); -+ goto -> bb90; ++ goto -> bb77; } - bb92: { + bb79: { - _60 = &mut _24; -- _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb91, unwind: bb38]; +- _59 = Pin::<&mut {closure@$DIR/async_drop.rs:78:25: 78:27}>::new_unchecked(move _60) -> [return: bb78, unwind: bb27]; + _183 = move _103; + StorageDead(_103); -+ goto -> bb97; ++ goto -> bb84; } - bb93: { + bb80: { - StorageDead(_61); -- goto -> bb14; +- goto -> bb4; + StorageLive(_103); + _0 = Poll::<()>::Pending; + StorageDead(_103); @@ -1051,91 +992,91 @@ + return; } - bb94: { + bb81: { - StorageDead(_61); -- goto -> bb27; +- goto -> bb17; + _105 = discriminant(_104); -+ switchInt(move _105) -> [0: bb88, 1: bb93, otherwise: bb43]; ++ switchInt(move _105) -> [0: bb75, 1: bb80, otherwise: bb30]; } -- bb95 (cleanup): { +- bb82 (cleanup): { - StorageDead(_61); -- goto -> bb40; -+ bb95: { -+ _104 = as Future>::poll(move _106, move _107) -> [return: bb94, unwind: bb89]; +- goto -> bb28; ++ bb82: { ++ _104 = as Future>::poll(move _106, move _107) -> [return: bb81, unwind: bb76]; } - bb96: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb96, unwind: bb95]; + bb83: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb83, unwind: bb82]; + _108 = move _183; + _107 = copy (_108.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb95; ++ goto -> bb82; } - bb97: { + bb84: { - _2 = move _62; - StorageDead(_62); -- goto -> bb96; +- goto -> bb83; + _109 = &mut (((*_182) as variant#12).7: impl std::future::Future); -+ _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb96, unwind: bb89]; ++ _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb83, unwind: bb76]; } - bb98: { + bb85: { - _2 = move _62; - StorageDead(_62); -- goto -> bb103; +- goto -> bb90; + nop; -+ (((*_182) as variant#12).7: impl std::future::Future) = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb97, unwind: bb89]; ++ (((*_182) as variant#12).7: impl std::future::Future) = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb84, unwind: bb76]; } - bb99: { + bb86: { - StorageLive(_62); -- _62 = yield(const ()) -> [resume: bb97, drop: bb98]; +- _62 = yield(const ()) -> [resume: bb84, drop: bb85]; + _111 = &mut (((*_182) as variant#12).6: AsyncEnum); -+ _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb98, unwind: bb32]; ++ _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb85, unwind: bb19]; } - bb100: { + bb87: { - _64 = discriminant(_63); -- switchInt(move _64) -> [0: bb94, 1: bb99, otherwise: bb59]; +- switchInt(move _64) -> [0: bb81, 1: bb86, otherwise: bb46]; + nop; -+ goto -> bb17; ++ goto -> bb7; } -- bb101: { -- _63 = as Future>::poll(move _65, move _66) -> [return: bb100, unwind: bb95]; -+ bb101 (cleanup): { +- bb88: { +- _63 = as Future>::poll(move _65, move _66) -> [return: bb87, unwind: bb82]; ++ bb88 (cleanup): { + nop; -+ goto -> bb33; ++ goto -> bb20; } - bb102: { + bb89: { - _67 = move _2; -- _66 = std::future::get_context::<'_, '_>(move _67) -> [return: bb101, unwind: bb95]; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb102, unwind: bb101]; +- _66 = std::future::get_context::<'_, '_>(move _67) -> [return: bb88, unwind: bb82]; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb89, unwind: bb88]; } - bb103: { + bb90: { - _68 = &mut _61; -- _65 = Pin::<&mut impl Future>::new_unchecked(move _68) -> [return: bb102, unwind: bb95]; +- _65 = Pin::<&mut impl Future>::new_unchecked(move _68) -> [return: bb89, unwind: bb82]; + _183 = move _113; + StorageDead(_113); -+ goto -> bb102; ++ goto -> bb89; } - bb104: { + bb91: { - _2 = move _69; - StorageDead(_69); -- goto -> bb110; +- goto -> bb97; + _183 = move _120; + StorageDead(_120); -+ goto -> bb109; ++ goto -> bb96; } - bb105: { + bb92: { - _2 = move _69; - StorageDead(_69); -- goto -> bb103; +- goto -> bb90; + StorageLive(_120); + _0 = Poll::<()>::Pending; + StorageDead(_120); @@ -1143,88 +1084,88 @@ + return; } - bb106: { + bb93: { - StorageLive(_69); -- _69 = yield(const ()) -> [resume: bb104, drop: bb105]; +- _69 = yield(const ()) -> [resume: bb91, drop: bb92]; + _122 = discriminant(_121); -+ switchInt(move _122) -> [0: bb100, 1: bb105, otherwise: bb43]; ++ switchInt(move _122) -> [0: bb87, 1: bb92, otherwise: bb30]; } - bb107: { + bb94: { - _71 = discriminant(_70); -- switchInt(move _71) -> [0: bb93, 1: bb106, otherwise: bb59]; -+ _121 = as Future>::poll(move _123, move _124) -> [return: bb106, unwind: bb101]; +- switchInt(move _71) -> [0: bb80, 1: bb93, otherwise: bb46]; ++ _121 = as Future>::poll(move _123, move _124) -> [return: bb93, unwind: bb88]; } - bb108: { -- _70 = as Future>::poll(move _72, move _73) -> [return: bb107, unwind: bb95]; + bb95: { +- _70 = as Future>::poll(move _72, move _73) -> [return: bb94, unwind: bb82]; + _125 = move _183; + _124 = copy (_125.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb107; ++ goto -> bb94; } - bb109: { + bb96: { - _74 = move _2; -- _73 = std::future::get_context::<'_, '_>(move _74) -> [return: bb108, unwind: bb95]; +- _73 = std::future::get_context::<'_, '_>(move _74) -> [return: bb95, unwind: bb82]; + _126 = &mut (((*_182) as variant#14).6: impl std::future::Future); -+ _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb108, unwind: bb101]; ++ _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb95, unwind: bb88]; } - bb110: { + bb97: { - _75 = &mut _61; -- _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb109, unwind: bb95]; +- _72 = Pin::<&mut impl Future>::new_unchecked(move _75) -> [return: bb96, unwind: bb82]; + nop; -+ (((*_182) as variant#14).6: impl std::future::Future) = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb109, unwind: bb101]; ++ (((*_182) as variant#14).6: impl std::future::Future) = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb96, unwind: bb88]; } - bb111: { + bb98: { - StorageLive(_61); -- _61 = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb110, unwind: bb95]; +- _61 = async_drop_in_place::>(copy (_76.0: &mut AsyncReference<'_>)) -> [return: bb97, unwind: bb82]; + _128 = &mut (((*_182) as variant#14).5: SyncThenAsync); -+ _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb110, unwind: bb33]; ++ _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb97, unwind: bb20]; } - bb112: { + bb99: { - _77 = &mut _20; -- _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb111, unwind: bb40]; +- _76 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _77) -> [return: bb98, unwind: bb28]; + nop; -+ goto -> bb18; ++ goto -> bb8; } -- bb113: { +- bb100: { - StorageDead(_78); -- goto -> bb15; -+ bb113 (cleanup): { +- goto -> bb5; ++ bb100 (cleanup): { + nop; -+ goto -> bb34; ++ goto -> bb21; } - bb114: { + bb101: { - StorageDead(_78); -- goto -> bb28; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb114, unwind: bb113]; +- goto -> bb18; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb101, unwind: bb100]; } -- bb115 (cleanup): { +- bb102 (cleanup): { - StorageDead(_78); -- goto -> bb41; -+ bb115: { +- goto -> bb29; ++ bb102: { + _183 = move _130; + StorageDead(_130); -+ goto -> bb114; ++ goto -> bb101; } - bb116: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb116, unwind: bb115]; + bb103: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb103, unwind: bb102]; + _183 = move _137; + StorageDead(_137); -+ goto -> bb121; ++ goto -> bb108; } - bb117: { + bb104: { - _2 = move _79; - StorageDead(_79); -- goto -> bb116; +- goto -> bb103; + StorageLive(_137); + _0 = Poll::<()>::Pending; + StorageDead(_137); @@ -1232,89 +1173,89 @@ + return; } - bb118: { + bb105: { - _2 = move _79; - StorageDead(_79); -- goto -> bb123; +- goto -> bb110; + _139 = discriminant(_138); -+ switchInt(move _139) -> [0: bb112, 1: bb117, otherwise: bb43]; ++ switchInt(move _139) -> [0: bb99, 1: bb104, otherwise: bb30]; } - bb119: { + bb106: { - StorageLive(_79); -- _79 = yield(const ()) -> [resume: bb117, drop: bb118]; -+ _138 = as Future>::poll(move _140, move _141) -> [return: bb118, unwind: bb113]; +- _79 = yield(const ()) -> [resume: bb104, drop: bb105]; ++ _138 = as Future>::poll(move _140, move _141) -> [return: bb105, unwind: bb100]; } - bb120: { + bb107: { - _81 = discriminant(_80); -- switchInt(move _81) -> [0: bb114, 1: bb119, otherwise: bb59]; +- switchInt(move _81) -> [0: bb101, 1: bb106, otherwise: bb46]; + _142 = move _183; + _141 = copy (_142.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb119; ++ goto -> bb106; } - bb121: { -- _80 = as Future>::poll(move _82, move _83) -> [return: bb120, unwind: bb115]; + bb108: { +- _80 = as Future>::poll(move _82, move _83) -> [return: bb107, unwind: bb102]; + _143 = &mut (((*_182) as variant#16).5: impl std::future::Future); -+ _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb120, unwind: bb113]; ++ _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb107, unwind: bb100]; } - bb122: { + bb109: { - _84 = move _2; -- _83 = std::future::get_context::<'_, '_>(move _84) -> [return: bb121, unwind: bb115]; +- _83 = std::future::get_context::<'_, '_>(move _84) -> [return: bb108, unwind: bb102]; + nop; -+ (((*_182) as variant#16).5: impl std::future::Future) = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb121, unwind: bb113]; ++ (((*_182) as variant#16).5: impl std::future::Future) = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb108, unwind: bb100]; } - bb123: { + bb110: { - _85 = &mut _78; -- _82 = Pin::<&mut impl Future>::new_unchecked(move _85) -> [return: bb122, unwind: bb115]; +- _82 = Pin::<&mut impl Future>::new_unchecked(move _85) -> [return: bb109, unwind: bb102]; + _145 = &mut (((*_182) as variant#16).4: AsyncStruct); -+ _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb122, unwind: bb34]; ++ _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb109, unwind: bb21]; } - bb124: { + bb111: { - _2 = move _86; - StorageDead(_86); -- goto -> bb130; +- goto -> bb117; + nop; -+ goto -> bb19; ++ goto -> bb9; } -- bb125: { +- bb112: { - _2 = move _86; - StorageDead(_86); -- goto -> bb123; -+ bb125 (cleanup): { +- goto -> bb110; ++ bb112 (cleanup): { + nop; -+ goto -> bb35; ++ goto -> bb22; } - bb126: { + bb113: { - StorageLive(_86); -- _86 = yield(const ()) -> [resume: bb124, drop: bb125]; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb126, unwind: bb125]; +- _86 = yield(const ()) -> [resume: bb111, drop: bb112]; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb113, unwind: bb112]; } - bb127: { + bb114: { - _88 = discriminant(_87); -- switchInt(move _88) -> [0: bb113, 1: bb126, otherwise: bb59]; +- switchInt(move _88) -> [0: bb100, 1: bb113, otherwise: bb46]; + _183 = move _147; + StorageDead(_147); -+ goto -> bb126; ++ goto -> bb113; } - bb128: { -- _87 = as Future>::poll(move _89, move _90) -> [return: bb127, unwind: bb115]; + bb115: { +- _87 = as Future>::poll(move _89, move _90) -> [return: bb114, unwind: bb102]; + _183 = move _154; + StorageDead(_154); -+ goto -> bb133; ++ goto -> bb120; } - bb129: { + bb116: { - _91 = move _2; -- _90 = std::future::get_context::<'_, '_>(move _91) -> [return: bb128, unwind: bb115]; +- _90 = std::future::get_context::<'_, '_>(move _91) -> [return: bb115, unwind: bb102]; + StorageLive(_154); + _0 = Poll::<()>::Pending; + StorageDead(_154); @@ -1322,89 +1263,89 @@ + return; } - bb130: { + bb117: { - _92 = &mut _78; -- _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb129, unwind: bb115]; +- _89 = Pin::<&mut impl Future>::new_unchecked(move _92) -> [return: bb116, unwind: bb102]; + _156 = discriminant(_155); -+ switchInt(move _156) -> [0: bb124, 1: bb129, otherwise: bb43]; ++ switchInt(move _156) -> [0: bb111, 1: bb116, otherwise: bb30]; } - bb131: { + bb118: { - StorageLive(_78); -- _78 = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb130, unwind: bb115]; -+ _155 = as Future>::poll(move _157, move _158) -> [return: bb130, unwind: bb125]; +- _78 = async_drop_in_place::(copy (_93.0: &mut AsyncInt)) -> [return: bb117, unwind: bb102]; ++ _155 = as Future>::poll(move _157, move _158) -> [return: bb117, unwind: bb112]; } - bb132: { + bb119: { - _94 = &mut _19; -- _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb131, unwind: bb41]; +- _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb118, unwind: bb29]; + _159 = move _183; + _158 = copy (_159.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb131; ++ goto -> bb118; } - bb133: { + bb120: { - StorageDead(_95); -- goto -> bb16; +- goto -> bb6; + _160 = &mut (((*_182) as variant#18).4: impl std::future::Future); -+ _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb132, unwind: bb125]; ++ _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb119, unwind: bb112]; } - bb134: { + bb121: { - StorageDead(_95); -- goto -> bb29; +- goto -> bb19; + nop; -+ (((*_182) as variant#18).4: impl std::future::Future) = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb133, unwind: bb125]; ++ (((*_182) as variant#18).4: impl std::future::Future) = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb120, unwind: bb112]; } -- bb135 (cleanup): { +- bb122 (cleanup): { - StorageDead(_95); -- goto -> bb45; -+ bb135: { +- goto -> bb32; ++ bb122: { + _162 = &mut (((*_182) as variant#18).3: [AsyncInt; 2]); -+ _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb134, unwind: bb35]; ++ _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb121, unwind: bb22]; } - bb136: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb136, unwind: bb135]; + bb123: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb123, unwind: bb122]; + nop; -+ goto -> bb20; ++ goto -> bb10; } -- bb137: { +- bb124: { - _2 = move _96; - StorageDead(_96); -- goto -> bb136; -+ bb137 (cleanup): { +- goto -> bb123; ++ bb124 (cleanup): { + nop; -+ goto -> bb36; ++ goto -> bb23; } - bb138: { + bb125: { - _2 = move _96; - StorageDead(_96); -- goto -> bb143; -+ assert(const false, "`async fn` resumed after async drop") -> [success: bb138, unwind: bb137]; +- goto -> bb130; ++ assert(const false, "`async fn` resumed after async drop") -> [success: bb125, unwind: bb124]; } - bb139: { + bb126: { - StorageLive(_96); -- _96 = yield(const ()) -> [resume: bb137, drop: bb138]; +- _96 = yield(const ()) -> [resume: bb124, drop: bb125]; + _183 = move _164; + StorageDead(_164); -+ goto -> bb138; ++ goto -> bb125; } - bb140: { + bb127: { - _98 = discriminant(_97); -- switchInt(move _98) -> [0: bb134, 1: bb139, otherwise: bb59]; +- switchInt(move _98) -> [0: bb121, 1: bb126, otherwise: bb46]; + _183 = move _171; + StorageDead(_171); -+ goto -> bb145; ++ goto -> bb132; } - bb141: { -- _97 = as Future>::poll(move _99, move _100) -> [return: bb140, unwind: bb135]; + bb128: { +- _97 = as Future>::poll(move _99, move _100) -> [return: bb127, unwind: bb122]; + StorageLive(_171); + _0 = Poll::<()>::Pending; + StorageDead(_171); @@ -1412,549 +1353,549 @@ + return; } - bb142: { + bb129: { - _101 = move _2; -- _100 = std::future::get_context::<'_, '_>(move _101) -> [return: bb141, unwind: bb135]; +- _100 = std::future::get_context::<'_, '_>(move _101) -> [return: bb128, unwind: bb122]; + _173 = discriminant(_172); -+ switchInt(move _173) -> [0: bb136, 1: bb141, otherwise: bb43]; ++ switchInt(move _173) -> [0: bb123, 1: bb128, otherwise: bb30]; } - bb143: { + bb130: { - _102 = &mut _95; -- _99 = Pin::<&mut impl Future>::new_unchecked(move _102) -> [return: bb142, unwind: bb135]; -+ _172 = as Future>::poll(move _174, move _175) -> [return: bb142, unwind: bb137]; +- _99 = Pin::<&mut impl Future>::new_unchecked(move _102) -> [return: bb129, unwind: bb122]; ++ _172 = as Future>::poll(move _174, move _175) -> [return: bb129, unwind: bb124]; } - bb144: { + bb131: { - _2 = move _103; - StorageDead(_103); -- goto -> bb150; +- goto -> bb137; + _176 = move _183; + _175 = copy (_176.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb143; ++ goto -> bb130; } - bb145: { + bb132: { - _2 = move _103; - StorageDead(_103); -- goto -> bb143; +- goto -> bb130; + _177 = &mut (((*_182) as variant#20).3: impl std::future::Future); -+ _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb144, unwind: bb137]; ++ _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb131, unwind: bb124]; } - bb146: { + bb133: { - StorageLive(_103); -- _103 = yield(const ()) -> [resume: bb144, drop: bb145]; +- _103 = yield(const ()) -> [resume: bb131, drop: bb132]; + nop; -+ (((*_182) as variant#20).3: impl std::future::Future) = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb145, unwind: bb137]; ++ (((*_182) as variant#20).3: impl std::future::Future) = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb132, unwind: bb124]; } - bb147: { + bb134: { - _105 = discriminant(_104); -- switchInt(move _105) -> [0: bb133, 1: bb146, otherwise: bb59]; +- switchInt(move _105) -> [0: bb120, 1: bb133, otherwise: bb46]; + _179 = &mut (((*_182) as variant#20).2: AsyncInt); -+ _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb146, unwind: bb36]; ++ _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb133, unwind: bb23]; } -- bb148: { -- _104 = as Future>::poll(move _106, move _107) -> [return: bb147, unwind: bb135]; -+ bb148 (cleanup): { +- bb135: { +- _104 = as Future>::poll(move _106, move _107) -> [return: bb134, unwind: bb122]; ++ bb135 (cleanup): { + discriminant((*_182)) = 2; + resume; } - bb149: { + bb136: { - _108 = move _2; -- _107 = std::future::get_context::<'_, '_>(move _108) -> [return: bb148, unwind: bb135]; +- _107 = std::future::get_context::<'_, '_>(move _108) -> [return: bb135, unwind: bb122]; + StorageLive(_17); + StorageLive(_23); + StorageLive(_25); + StorageLive(_28); + _28 = move _183; -+ goto -> bb42; ++ goto -> bb29; } - bb150: { + bb137: { - _109 = &mut _95; -- _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb149, unwind: bb135]; +- _106 = Pin::<&mut impl Future>::new_unchecked(move _109) -> [return: bb136, unwind: bb122]; + StorageLive(_17); + StorageLive(_23); + StorageLive(_25); + StorageLive(_35); + _35 = move _183; -+ goto -> bb44; ++ goto -> bb31; } - bb151: { + bb138: { - StorageLive(_95); -- _95 = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb150, unwind: bb135]; +- _95 = async_drop_in_place::(copy (_110.0: &mut AsyncEnum)) -> [return: bb137, unwind: bb122]; + StorageLive(_17); + StorageLive(_23); + StorageLive(_45); + _45 = move _183; -+ goto -> bb55; ++ goto -> bb42; } - bb152: { + bb139: { - _111 = &mut _15; -- _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb151, unwind: bb45]; +- _110 = Pin::<&mut AsyncEnum>::new_unchecked(move _111) -> [return: bb138, unwind: bb32]; + StorageLive(_17); + StorageLive(_23); + StorageLive(_52); + _52 = move _183; -+ goto -> bb56; ++ goto -> bb43; } - bb153: { + bb140: { - StorageDead(_112); -- goto -> bb17; +- goto -> bb7; + StorageLive(_17); + StorageLive(_62); + _62 = move _183; -+ goto -> bb67; ++ goto -> bb54; } - bb154: { + bb141: { - StorageDead(_112); -- goto -> bb30; +- goto -> bb20; + StorageLive(_17); + StorageLive(_69); + _69 = move _183; -+ goto -> bb68; ++ goto -> bb55; } -- bb155 (cleanup): { +- bb142 (cleanup): { - StorageDead(_112); -- goto -> bb46; -+ bb155: { +- goto -> bb33; ++ bb142: { + StorageLive(_17); + StorageLive(_79); + _79 = move _183; -+ goto -> bb79; ++ goto -> bb66; } - bb156: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb156, unwind: bb155]; + bb143: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb143, unwind: bb142]; + StorageLive(_17); + StorageLive(_86); + _86 = move _183; -+ goto -> bb80; ++ goto -> bb67; } - bb157: { + bb144: { - _2 = move _113; - StorageDead(_113); -- goto -> bb156; +- goto -> bb143; + StorageLive(_96); + _96 = move _183; -+ goto -> bb91; ++ goto -> bb78; } - bb158: { + bb145: { - _2 = move _113; - StorageDead(_113); -- goto -> bb163; +- goto -> bb150; + StorageLive(_103); + _103 = move _183; -+ goto -> bb92; ++ goto -> bb79; } - bb159: { + bb146: { StorageLive(_113); -- _113 = yield(const ()) -> [resume: bb157, drop: bb158]; +- _113 = yield(const ()) -> [resume: bb144, drop: bb145]; + _113 = move _183; -+ goto -> bb103; ++ goto -> bb90; } - bb160: { + bb147: { - _115 = discriminant(_114); -- switchInt(move _115) -> [0: bb154, 1: bb159, otherwise: bb59]; +- switchInt(move _115) -> [0: bb141, 1: bb146, otherwise: bb46]; + StorageLive(_120); + _120 = move _183; -+ goto -> bb104; ++ goto -> bb91; } - bb161: { -- _114 = as Future>::poll(move _116, move _117) -> [return: bb160, unwind: bb155]; + bb148: { +- _114 = as Future>::poll(move _116, move _117) -> [return: bb147, unwind: bb142]; + StorageLive(_130); + _130 = move _183; -+ goto -> bb115; ++ goto -> bb102; } - bb162: { + bb149: { - _118 = move _2; -- _117 = std::future::get_context::<'_, '_>(move _118) -> [return: bb161, unwind: bb155]; +- _117 = std::future::get_context::<'_, '_>(move _118) -> [return: bb148, unwind: bb142]; + StorageLive(_137); + _137 = move _183; -+ goto -> bb116; ++ goto -> bb103; } - bb163: { + bb150: { - _119 = &mut _112; -- _116 = Pin::<&mut impl Future>::new_unchecked(move _119) -> [return: bb162, unwind: bb155]; +- _116 = Pin::<&mut impl Future>::new_unchecked(move _119) -> [return: bb149, unwind: bb142]; + StorageLive(_147); + _147 = move _183; -+ goto -> bb127; ++ goto -> bb114; } - bb164: { + bb151: { - _2 = move _120; - StorageDead(_120); -- goto -> bb170; +- goto -> bb157; + StorageLive(_154); + _154 = move _183; -+ goto -> bb128; ++ goto -> bb115; } - bb165: { + bb152: { - _2 = move _120; - StorageDead(_120); -- goto -> bb163; +- goto -> bb150; + StorageLive(_164); + _164 = move _183; -+ goto -> bb139; ++ goto -> bb126; } - bb166: { + bb153: { - StorageLive(_120); -- _120 = yield(const ()) -> [resume: bb164, drop: bb165]; +- _120 = yield(const ()) -> [resume: bb151, drop: bb152]; + StorageLive(_171); + _171 = move _183; -+ goto -> bb140; ++ goto -> bb127; } - bb167: { + bb154: { - _122 = discriminant(_121); -- switchInt(move _122) -> [0: bb153, 1: bb166, otherwise: bb59]; -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb167, unwind continue]; +- switchInt(move _122) -> [0: bb140, 1: bb153, otherwise: bb46]; ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb154, unwind continue]; } - bb168: { -- _121 = as Future>::poll(move _123, move _124) -> [return: bb167, unwind: bb155]; -+ assert(const false, "`async fn` resumed after completion") -> [success: bb168, unwind continue]; + bb155: { +- _121 = as Future>::poll(move _123, move _124) -> [return: bb154, unwind: bb142]; ++ assert(const false, "`async fn` resumed after completion") -> [success: bb155, unwind continue]; } - bb169: { + bb156: { - _125 = move _2; -- _124 = std::future::get_context::<'_, '_>(move _125) -> [return: bb168, unwind: bb155]; +- _124 = std::future::get_context::<'_, '_>(move _125) -> [return: bb155, unwind: bb142]; - } - -- bb170: { +- bb157: { - _126 = &mut _112; -- _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb169, unwind: bb155]; +- _123 = Pin::<&mut impl Future>::new_unchecked(move _126) -> [return: bb156, unwind: bb142]; - } - -- bb171: { +- bb158: { - StorageLive(_112); -- _112 = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb170, unwind: bb155]; +- _112 = async_drop_in_place::(copy (_127.0: &mut SyncThenAsync)) -> [return: bb157, unwind: bb142]; - } - -- bb172: { +- bb159: { - _128 = &mut _11; -- _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb171, unwind: bb46]; +- _127 = Pin::<&mut SyncThenAsync>::new_unchecked(move _128) -> [return: bb158, unwind: bb33]; - } - -- bb173: { +- bb160: { - StorageDead(_129); -- goto -> bb18; +- goto -> bb8; - } - -- bb174: { +- bb161: { - StorageDead(_129); -- goto -> bb31; +- goto -> bb21; - } - -- bb175 (cleanup): { +- bb162 (cleanup): { - StorageDead(_129); -- goto -> bb47; +- goto -> bb34; - } - -- bb176: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb176, unwind: bb175]; +- bb163: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb163, unwind: bb162]; - } - -- bb177: { +- bb164: { - _2 = move _130; - StorageDead(_130); -- goto -> bb176; +- goto -> bb163; - } - -- bb178: { +- bb165: { - _2 = move _130; - StorageDead(_130); -- goto -> bb183; +- goto -> bb170; - } - -- bb179: { +- bb166: { - StorageLive(_130); -- _130 = yield(const ()) -> [resume: bb177, drop: bb178]; +- _130 = yield(const ()) -> [resume: bb164, drop: bb165]; - } - -- bb180: { +- bb167: { - _132 = discriminant(_131); -- switchInt(move _132) -> [0: bb174, 1: bb179, otherwise: bb59]; +- switchInt(move _132) -> [0: bb161, 1: bb166, otherwise: bb46]; - } - -- bb181: { -- _131 = as Future>::poll(move _133, move _134) -> [return: bb180, unwind: bb175]; +- bb168: { +- _131 = as Future>::poll(move _133, move _134) -> [return: bb167, unwind: bb162]; - } - -- bb182: { +- bb169: { - _135 = move _2; -- _134 = std::future::get_context::<'_, '_>(move _135) -> [return: bb181, unwind: bb175]; +- _134 = std::future::get_context::<'_, '_>(move _135) -> [return: bb168, unwind: bb162]; - } - -- bb183: { +- bb170: { - _136 = &mut _129; -- _133 = Pin::<&mut impl Future>::new_unchecked(move _136) -> [return: bb182, unwind: bb175]; +- _133 = Pin::<&mut impl Future>::new_unchecked(move _136) -> [return: bb169, unwind: bb162]; - } - -- bb184: { +- bb171: { - _2 = move _137; - StorageDead(_137); -- goto -> bb190; +- goto -> bb177; - } - -- bb185: { +- bb172: { - _2 = move _137; - StorageDead(_137); -- goto -> bb183; +- goto -> bb170; - } - -- bb186: { +- bb173: { - StorageLive(_137); -- _137 = yield(const ()) -> [resume: bb184, drop: bb185]; +- _137 = yield(const ()) -> [resume: bb171, drop: bb172]; - } - -- bb187: { +- bb174: { - _139 = discriminant(_138); -- switchInt(move _139) -> [0: bb173, 1: bb186, otherwise: bb59]; +- switchInt(move _139) -> [0: bb160, 1: bb173, otherwise: bb46]; - } - -- bb188: { -- _138 = as Future>::poll(move _140, move _141) -> [return: bb187, unwind: bb175]; +- bb175: { +- _138 = as Future>::poll(move _140, move _141) -> [return: bb174, unwind: bb162]; - } - -- bb189: { +- bb176: { - _142 = move _2; -- _141 = std::future::get_context::<'_, '_>(move _142) -> [return: bb188, unwind: bb175]; +- _141 = std::future::get_context::<'_, '_>(move _142) -> [return: bb175, unwind: bb162]; - } - -- bb190: { +- bb177: { - _143 = &mut _129; -- _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb189, unwind: bb175]; +- _140 = Pin::<&mut impl Future>::new_unchecked(move _143) -> [return: bb176, unwind: bb162]; - } - -- bb191: { +- bb178: { - StorageLive(_129); -- _129 = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb190, unwind: bb175]; +- _129 = async_drop_in_place::(copy (_144.0: &mut AsyncStruct)) -> [return: bb177, unwind: bb162]; - } - -- bb192: { +- bb179: { - _145 = &mut _8; -- _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb191, unwind: bb47]; +- _144 = Pin::<&mut AsyncStruct>::new_unchecked(move _145) -> [return: bb178, unwind: bb34]; - } - -- bb193: { +- bb180: { - StorageDead(_146); -- goto -> bb19; +- goto -> bb9; - } - -- bb194: { +- bb181: { - StorageDead(_146); -- goto -> bb32; +- goto -> bb22; - } - -- bb195 (cleanup): { +- bb182 (cleanup): { - StorageDead(_146); -- goto -> bb48; +- goto -> bb35; - } - -- bb196: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb196, unwind: bb195]; +- bb183: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb183, unwind: bb182]; - } - -- bb197: { +- bb184: { - _2 = move _147; - StorageDead(_147); -- goto -> bb196; +- goto -> bb183; - } - -- bb198: { +- bb185: { - _2 = move _147; - StorageDead(_147); -- goto -> bb203; +- goto -> bb190; - } - -- bb199: { +- bb186: { - StorageLive(_147); -- _147 = yield(const ()) -> [resume: bb197, drop: bb198]; +- _147 = yield(const ()) -> [resume: bb184, drop: bb185]; - } - -- bb200: { +- bb187: { - _149 = discriminant(_148); -- switchInt(move _149) -> [0: bb194, 1: bb199, otherwise: bb59]; +- switchInt(move _149) -> [0: bb181, 1: bb186, otherwise: bb46]; - } - -- bb201: { -- _148 = as Future>::poll(move _150, move _151) -> [return: bb200, unwind: bb195]; +- bb188: { +- _148 = as Future>::poll(move _150, move _151) -> [return: bb187, unwind: bb182]; - } - -- bb202: { +- bb189: { - _152 = move _2; -- _151 = std::future::get_context::<'_, '_>(move _152) -> [return: bb201, unwind: bb195]; +- _151 = std::future::get_context::<'_, '_>(move _152) -> [return: bb188, unwind: bb182]; - } - -- bb203: { +- bb190: { - _153 = &mut _146; -- _150 = Pin::<&mut impl Future>::new_unchecked(move _153) -> [return: bb202, unwind: bb195]; +- _150 = Pin::<&mut impl Future>::new_unchecked(move _153) -> [return: bb189, unwind: bb182]; - } - -- bb204: { +- bb191: { - _2 = move _154; - StorageDead(_154); -- goto -> bb210; +- goto -> bb197; - } - -- bb205: { +- bb192: { - _2 = move _154; - StorageDead(_154); -- goto -> bb203; +- goto -> bb190; - } - -- bb206: { +- bb193: { - StorageLive(_154); -- _154 = yield(const ()) -> [resume: bb204, drop: bb205]; +- _154 = yield(const ()) -> [resume: bb191, drop: bb192]; - } - -- bb207: { +- bb194: { - _156 = discriminant(_155); -- switchInt(move _156) -> [0: bb193, 1: bb206, otherwise: bb59]; +- switchInt(move _156) -> [0: bb180, 1: bb193, otherwise: bb46]; - } - -- bb208: { -- _155 = as Future>::poll(move _157, move _158) -> [return: bb207, unwind: bb195]; +- bb195: { +- _155 = as Future>::poll(move _157, move _158) -> [return: bb194, unwind: bb182]; - } - -- bb209: { +- bb196: { - _159 = move _2; -- _158 = std::future::get_context::<'_, '_>(move _159) -> [return: bb208, unwind: bb195]; +- _158 = std::future::get_context::<'_, '_>(move _159) -> [return: bb195, unwind: bb182]; - } - -- bb210: { +- bb197: { - _160 = &mut _146; -- _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb209, unwind: bb195]; +- _157 = Pin::<&mut impl Future>::new_unchecked(move _160) -> [return: bb196, unwind: bb182]; - } - -- bb211: { +- bb198: { - StorageLive(_146); -- _146 = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb210, unwind: bb195]; +- _146 = async_drop_in_place::<[AsyncInt; 2]>(copy (_161.0: &mut [AsyncInt; 2])) -> [return: bb197, unwind: bb182]; - } - -- bb212: { +- bb199: { - _162 = &mut _5; -- _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb211, unwind: bb48]; +- _161 = Pin::<&mut [AsyncInt; 2]>::new_unchecked(move _162) -> [return: bb198, unwind: bb35]; - } - -- bb213: { +- bb200: { - StorageDead(_163); -- goto -> bb20; +- goto -> bb10; - } - -- bb214: { +- bb201: { - StorageDead(_163); -- goto -> bb33; +- goto -> bb23; - } - -- bb215 (cleanup): { +- bb202 (cleanup): { - StorageDead(_163); -- goto -> bb49; +- goto -> bb36; - } - -- bb216: { -- assert(const false, "`async fn` resumed after async drop") -> [success: bb216, unwind: bb215]; +- bb203: { +- assert(const false, "`async fn` resumed after async drop") -> [success: bb203, unwind: bb202]; - } - -- bb217: { +- bb204: { - _2 = move _164; - StorageDead(_164); -- goto -> bb216; +- goto -> bb203; - } - -- bb218: { +- bb205: { - _2 = move _164; - StorageDead(_164); -- goto -> bb223; +- goto -> bb210; - } - -- bb219: { +- bb206: { - StorageLive(_164); -- _164 = yield(const ()) -> [resume: bb217, drop: bb218]; +- _164 = yield(const ()) -> [resume: bb204, drop: bb205]; - } - -- bb220: { +- bb207: { - _166 = discriminant(_165); -- switchInt(move _166) -> [0: bb214, 1: bb219, otherwise: bb59]; +- switchInt(move _166) -> [0: bb201, 1: bb206, otherwise: bb46]; - } - -- bb221: { -- _165 = as Future>::poll(move _167, move _168) -> [return: bb220, unwind: bb215]; +- bb208: { +- _165 = as Future>::poll(move _167, move _168) -> [return: bb207, unwind: bb202]; - } - -- bb222: { +- bb209: { - _169 = move _2; -- _168 = std::future::get_context::<'_, '_>(move _169) -> [return: bb221, unwind: bb215]; +- _168 = std::future::get_context::<'_, '_>(move _169) -> [return: bb208, unwind: bb202]; - } - -- bb223: { +- bb210: { - _170 = &mut _163; -- _167 = Pin::<&mut impl Future>::new_unchecked(move _170) -> [return: bb222, unwind: bb215]; +- _167 = Pin::<&mut impl Future>::new_unchecked(move _170) -> [return: bb209, unwind: bb202]; - } - -- bb224: { +- bb211: { - _2 = move _171; - StorageDead(_171); -- goto -> bb230; +- goto -> bb217; - } - -- bb225: { +- bb212: { - _2 = move _171; - StorageDead(_171); -- goto -> bb223; +- goto -> bb210; - } - -- bb226: { +- bb213: { - StorageLive(_171); -- _171 = yield(const ()) -> [resume: bb224, drop: bb225]; +- _171 = yield(const ()) -> [resume: bb211, drop: bb212]; - } - -- bb227: { +- bb214: { - _173 = discriminant(_172); -- switchInt(move _173) -> [0: bb213, 1: bb226, otherwise: bb59]; +- switchInt(move _173) -> [0: bb200, 1: bb213, otherwise: bb46]; - } - -- bb228: { -- _172 = as Future>::poll(move _174, move _175) -> [return: bb227, unwind: bb215]; +- bb215: { +- _172 = as Future>::poll(move _174, move _175) -> [return: bb214, unwind: bb202]; - } - -- bb229: { +- bb216: { - _176 = move _2; -- _175 = std::future::get_context::<'_, '_>(move _176) -> [return: bb228, unwind: bb215]; +- _175 = std::future::get_context::<'_, '_>(move _176) -> [return: bb215, unwind: bb202]; - } - -- bb230: { +- bb217: { - _177 = &mut _163; -- _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb229, unwind: bb215]; +- _174 = Pin::<&mut impl Future>::new_unchecked(move _177) -> [return: bb216, unwind: bb202]; - } - -- bb231: { +- bb218: { - StorageLive(_163); -- _163 = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb230, unwind: bb215]; +- _163 = async_drop_in_place::(copy (_178.0: &mut AsyncInt)) -> [return: bb217, unwind: bb202]; - } - -- bb232: { +- bb219: { - _179 = &mut _4; -- _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb231, unwind: bb49]; +- _178 = Pin::<&mut AsyncInt>::new_unchecked(move _179) -> [return: bb218, unwind: bb36]; + nop; + (((*_182) as variant#20).1: SyncInt) = SyncInt(const 0_i32); + nop; @@ -1965,7 +1906,36 @@ + StorageLive(_7); + _7 = AsyncInt(const 2_i32); + (((*_182) as variant#18).3: [AsyncInt; 2]) = [move _6, move _7]; -+ goto -> bb1; ++ StorageDead(_7); ++ StorageDead(_6); ++ nop; ++ StorageLive(_9); ++ _9 = AsyncInt(const 5_i32); ++ StorageLive(_10); ++ _10 = AsyncInt(const 4_i32); ++ (((*_182) as variant#16).4: AsyncStruct) = AsyncStruct { i: const 3_i32, a: move _10, b: move _9 }; ++ StorageDead(_10); ++ StorageDead(_9); ++ nop; ++ StorageLive(_12); ++ _12 = AsyncInt(const 7_i32); ++ StorageLive(_13); ++ _13 = SyncInt(const 8_i32); ++ StorageLive(_14); ++ _14 = AsyncInt(const 9_i32); ++ (((*_182) as variant#14).5: SyncThenAsync) = SyncThenAsync { i: const 6_i32, a: move _12, b: move _13, c: move _14 }; ++ StorageDead(_14); ++ StorageDead(_13); ++ StorageDead(_12); ++ nop; ++ StorageLive(_16); ++ _16 = AsyncInt(const 10_i32); ++ (((*_182) as variant#12).6: AsyncEnum) = AsyncEnum::A(move _16); ++ StorageDead(_16); ++ StorageLive(_17); ++ StorageLive(_18); ++ _18 = AsyncInt(const 11_i32); ++ _17 = ManuallyDrop::::new(move _18) -> [return: bb1, unwind: bb17]; } } diff --git a/tests/mir-opt/coroutine/async_fn.add-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.add-{closure#0}.StateTransform.diff index b6c22224c74f8..02202cdc5181e 100644 --- a/tests/mir-opt/coroutine/async_fn.add-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.add-{closure#0}.StateTransform.diff @@ -90,12 +90,12 @@ - StorageLive(_8); - StorageLive(_9); - _9 = move _5; -- _8 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as IntoFuture>::into_future(move _9) -> [return: bb1, unwind: bb24]; +- _8 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as IntoFuture>::into_future(move _9) -> [return: bb1, unwind: bb20]; + _29 = move _2 as std::ptr::NonNull> (Transmute); + _28 = std::future::ResumeTy(move _29); + _27 = copy (_1.0: &mut {async fn body of add()}); + _26 = discriminant((*_27)); -+ switchInt(move _26) -> [0: bb27, 1: bb26, 2: bb25, 3: bb24, otherwise: bb6]; ++ switchInt(move _26) -> [0: bb23, 1: bb22, 2: bb21, 3: bb20, otherwise: bb6]; } bb1: { @@ -117,8 +117,8 @@ - _16 = &mut _10; + _16 = &mut (((*_27) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18}); _15 = &mut (*_16); -- _14 = Pin::<&mut {async block@$DIR/async_fn.rs:34:13: 34:18}>::new_unchecked(move _15) -> [return: bb3, unwind: bb21]; -+ _14 = Pin::<&mut {async block@$DIR/async_fn.rs:34:13: 34:18}>::new_unchecked(move _15) -> [return: bb3, unwind: bb15]; +- _14 = Pin::<&mut {async block@$DIR/async_fn.rs:34:13: 34:18}>::new_unchecked(move _15) -> [return: bb3, unwind: bb17]; ++ _14 = Pin::<&mut {async block@$DIR/async_fn.rs:34:13: 34:18}>::new_unchecked(move _15) -> [return: bb3, unwind: bb13]; } bb3: { @@ -127,7 +127,7 @@ StorageLive(_18); StorageLive(_19); - _19 = copy _2; -- _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb4, unwind: bb19]; +- _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb4, unwind: bb15]; + _19 = copy _28; + _18 = copy (_19.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb4; @@ -136,8 +136,8 @@ bb4: { _17 = &mut (*_18); StorageDead(_19); -- _13 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as Future>::poll(move _14, move _17) -> [return: bb5, unwind: bb20]; -+ _13 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as Future>::poll(move _14, move _17) -> [return: bb5, unwind: bb14]; +- _13 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as Future>::poll(move _14, move _17) -> [return: bb5, unwind: bb16]; ++ _13 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as Future>::poll(move _14, move _17) -> [return: bb5, unwind: bb12]; } bb5: { @@ -161,7 +161,7 @@ StorageLive(_23); StorageLive(_24); _24 = (); -- _23 = yield(move _24) -> [resume: bb9, drop: bb14]; +- _23 = yield(move _24) -> [resume: bb9, drop: bb12]; + _0 = Poll::::Pending; + StorageDead(_5); + StorageDead(_8); @@ -179,8 +179,8 @@ StorageDead(_21); StorageDead(_13); StorageDead(_12); -- drop(_10) -> [return: bb10, unwind: bb23]; -+ drop((((*_27) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb10, unwind: bb17]; +- drop(_10) -> [return: bb10, unwind: bb19]; ++ drop((((*_27) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb10, unwind: bb15]; } bb9: { @@ -195,115 +195,98 @@ bb10: { - StorageDead(_10); + nop; - goto -> bb11; - } - - bb11: { StorageDead(_8); - goto -> bb12; - } - - bb12: { StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb13, unwind: bb28]; +- drop(_1) -> [return: bb11, unwind: bb22]; + nop; + nop; -+ goto -> bb13; ++ goto -> bb11; } - bb13: { + bb11: { + _0 = Poll::::Ready(move _25); + discriminant((*_27)) = 1; return; } -- bb14: { +- bb12: { - StorageDead(_24); - StorageDead(_23); -- drop(_10) -> [return: bb15, unwind: bb29]; -+ bb14 (cleanup): { +- drop(_10) -> [return: bb13, unwind: bb23]; ++ bb12 (cleanup): { + StorageDead(_18); + StorageDead(_17); -+ goto -> bb16; ++ goto -> bb14; } -- bb15: { +- bb13: { - StorageDead(_10); -+ bb15 (cleanup): { -+ StorageDead(_15); - goto -> bb16; - } - -- bb16: { - StorageDead(_8); -- goto -> bb17; -+ bb16 (cleanup): { -+ StorageDead(_16); -+ StorageDead(_14); -+ StorageDead(_13); -+ StorageDead(_12); -+ drop((((*_27) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb17, unwind terminate(cleanup)]; - } - -- bb17: { - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb18, unwind: bb28]; -+ bb17 (cleanup): { -+ nop; -+ goto -> bb20; +- drop(_1) -> [return: bb14, unwind: bb22]; ++ bb13 (cleanup): { ++ StorageDead(_15); ++ goto -> bb14; } -- bb18: { +- bb14: { - coroutine_drop; -+ bb18 (cleanup): { -+ goto -> bb19; ++ bb14 (cleanup): { ++ StorageDead(_16); ++ StorageDead(_14); ++ StorageDead(_13); ++ StorageDead(_12); ++ drop((((*_27) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb15, unwind terminate(cleanup)]; } - bb19 (cleanup): { + bb15 (cleanup): { - StorageDead(_19); -+ StorageDead(_9); - goto -> bb20; +- goto -> bb16; ++ nop; ++ goto -> bb17; } - bb20 (cleanup): { + bb16 (cleanup): { - StorageDead(_18); - StorageDead(_17); -- goto -> bb22; -+ StorageDead(_8); -+ goto -> bb21; +- goto -> bb18; ++ StorageDead(_9); ++ goto -> bb17; } - bb21 (cleanup): { + bb17 (cleanup): { - StorageDead(_15); ++ StorageDead(_8); + StorageDead(_5); + nop; + nop; - goto -> bb22; + goto -> bb18; } - bb22 (cleanup): { + bb18 (cleanup): { - StorageDead(_16); - StorageDead(_14); - StorageDead(_13); - StorageDead(_12); -- drop(_10) -> [return: bb23, unwind terminate(cleanup)]; -+ goto -> bb23; +- drop(_10) -> [return: bb19, unwind terminate(cleanup)]; ++ goto -> bb19; } - bb23 (cleanup): { + bb19 (cleanup): { - StorageDead(_10); -- goto -> bb26; +- goto -> bb21; + discriminant((*_27)) = 2; + resume; } -- bb24 (cleanup): { -- goto -> bb25; -+ bb24: { +- bb20 (cleanup): { +- StorageDead(_9); +- goto -> bb21; ++ bb20: { + StorageLive(_5); + StorageLive(_8); + StorageLive(_23); @@ -312,47 +295,30 @@ + goto -> bb9; } -- bb25 (cleanup): { -- StorageDead(_9); -- goto -> bb26; -+ bb25: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb25, unwind continue]; - } - -- bb26 (cleanup): { +- bb21 (cleanup): { - StorageDead(_8); -- goto -> bb27; -+ bb26: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb26, unwind continue]; - } - -- bb27 (cleanup): { - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb28, unwind terminate(cleanup)]; -- } -- -- bb28 (cleanup): { +- drop(_1) -> [return: bb22, unwind terminate(cleanup)]; ++ bb21: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb21, unwind continue]; + } + +- bb22 (cleanup): { - resume; -- } -- -- bb29 (cleanup): { ++ bb22: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb22, unwind continue]; + } + +- bb23 (cleanup): { - StorageDead(_10); -- goto -> bb30; -- } -- -- bb30 (cleanup): { - StorageDead(_8); -- goto -> bb31; -- } -- -- bb31 (cleanup): { - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb28, unwind terminate(cleanup)]; -+ bb27: { +- drop(_1) -> [return: bb22, unwind terminate(cleanup)]; ++ bb23: { + nop; + (((*_27) as variant#3).0: u32) = copy ((*_27).0: u32); + nop; @@ -368,7 +334,7 @@ + StorageLive(_8); + StorageLive(_9); + _9 = move _5; -+ _8 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as IntoFuture>::into_future(move _9) -> [return: bb1, unwind: bb18]; ++ _8 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as IntoFuture>::into_future(move _9) -> [return: bb1, unwind: bb16]; } } diff --git a/tests/mir-opt/coroutine/async_fn.add-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.add-{closure#0}.coroutine_drop.0.mir index cd2092e97177a..22bf9ed28cd7a 100644 --- a/tests/mir-opt/coroutine/async_fn.add-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.add-{closure#0}.coroutine_drop.0.mir @@ -48,66 +48,50 @@ fn add::{closure#0}(_1: &mut {async fn body of add()}) -> () { bb0: { _26 = discriminant((*_1)); - switchInt(move _26) -> [0: bb11, 3: bb12, otherwise: bb13]; + switchInt(move _26) -> [0: bb7, 3: bb8, otherwise: bb9]; } bb1: { StorageDead(_24); StorageDead(_23); - drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb2, unwind: bb7]; + drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:34:13: 34:18})) -> [return: bb2, unwind: bb5]; } bb2: { nop; - goto -> bb3; - } - - bb3: { StorageDead(_8); - goto -> bb4; - } - - bb4: { StorageDead(_5); nop; nop; - goto -> bb5; + goto -> bb3; } - bb5: { + bb3: { return; } - bb6 (cleanup): { + bb4 (cleanup): { resume; } - bb7 (cleanup): { + bb5 (cleanup): { nop; - goto -> bb8; - } - - bb8 (cleanup): { StorageDead(_8); - goto -> bb9; - } - - bb9 (cleanup): { StorageDead(_5); nop; nop; - goto -> bb6; + goto -> bb4; } - bb10: { + bb6: { return; } - bb11: { - goto -> bb10; + bb7: { + goto -> bb6; } - bb12: { + bb8: { StorageLive(_5); StorageLive(_8); StorageLive(_23); @@ -115,7 +99,7 @@ fn add::{closure#0}(_1: &mut {async fn body of add()}) -> () { goto -> bb1; } - bb13: { + bb9: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.StateTransform.diff index b28ba99b82191..b2f02c6d2a92d 100644 --- a/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.StateTransform.diff @@ -136,19 +136,19 @@ - _11 = copy _3; - StorageLive(_12); - _12 = copy _4; -- _10 = add(move _11, move _12) -> [return: bb1, unwind: bb49]; +- _10 = add(move _11, move _12) -> [return: bb1, unwind: bb42]; + _53 = move _2 as std::ptr::NonNull> (Transmute); + _52 = std::future::ResumeTy(move _53); + _51 = copy (_1.0: &mut {async fn body of build_aggregate()}); + _50 = discriminant((*_51)); -+ switchInt(move _50) -> [0: bb48, 1: bb47, 2: bb46, 3: bb44, 4: bb45, otherwise: bb7]; ++ switchInt(move _50) -> [0: bb43, 1: bb42, 2: bb41, 3: bb39, 4: bb40, otherwise: bb7]; } bb1: { StorageDead(_12); StorageDead(_11); -- _9 = <{async fn body of add()} as IntoFuture>::into_future(move _10) -> [return: bb2, unwind: bb48]; -+ _9 = <{async fn body of add()} as IntoFuture>::into_future(move _10) -> [return: bb2, unwind: bb38]; +- _9 = <{async fn body of add()} as IntoFuture>::into_future(move _10) -> [return: bb2, unwind: bb43]; ++ _9 = <{async fn body of add()} as IntoFuture>::into_future(move _10) -> [return: bb2, unwind: bb35]; } bb2: { @@ -170,8 +170,8 @@ - _19 = &mut _13; + _19 = &mut (((*_51) as variant#3).2: {async fn body of add()}); _18 = &mut (*_19); -- _17 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _18) -> [return: bb4, unwind: bb44]; -+ _17 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _18) -> [return: bb4, unwind: bb34]; +- _17 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _18) -> [return: bb4, unwind: bb39]; ++ _17 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _18) -> [return: bb4, unwind: bb31]; } bb4: { @@ -180,7 +180,7 @@ StorageLive(_21); StorageLive(_22); - _22 = copy _2; -- _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb5, unwind: bb42]; +- _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb5, unwind: bb37]; + _22 = copy _52; + _21 = copy (_22.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb5; @@ -189,8 +189,8 @@ bb5: { _20 = &mut (*_21); StorageDead(_22); -- _16 = <{async fn body of add()} as Future>::poll(move _17, move _20) -> [return: bb6, unwind: bb43]; -+ _16 = <{async fn body of add()} as Future>::poll(move _17, move _20) -> [return: bb6, unwind: bb33]; +- _16 = <{async fn body of add()} as Future>::poll(move _17, move _20) -> [return: bb6, unwind: bb38]; ++ _16 = <{async fn body of add()} as Future>::poll(move _17, move _20) -> [return: bb6, unwind: bb30]; } bb6: { @@ -214,7 +214,7 @@ StorageLive(_26); StorageLive(_27); _27 = (); -- _26 = yield(move _27) -> [resume: bb10, drop: bb28]; +- _26 = yield(move _27) -> [resume: bb10, drop: bb25]; + _0 = Poll::::Pending; + StorageDead(_3); + StorageDead(_4); @@ -234,8 +234,8 @@ StorageDead(_24); StorageDead(_16); StorageDead(_15); -- drop(_13) -> [return: bb11, unwind: bb46]; -+ drop((((*_51) as variant#3).2: {async fn body of add()})) -> [return: bb11, unwind: bb36]; +- drop(_13) -> [return: bb11, unwind: bb41]; ++ drop((((*_51) as variant#3).2: {async fn body of add()})) -> [return: bb11, unwind: bb33]; } bb10: { @@ -258,16 +258,16 @@ + _31 = copy (((*_51) as variant#3).0: u32); StorageLive(_32); - _32 = copy _6; -- _30 = add(move _31, move _32) -> [return: bb12, unwind: bb39]; +- _30 = add(move _31, move _32) -> [return: bb12, unwind: bb34]; + _32 = copy (((*_51) as variant#3).1: u32); -+ _30 = add(move _31, move _32) -> [return: bb12, unwind: bb30]; ++ _30 = add(move _31, move _32) -> [return: bb12, unwind: bb27]; } bb12: { StorageDead(_32); StorageDead(_31); -- _29 = <{async fn body of add()} as IntoFuture>::into_future(move _30) -> [return: bb13, unwind: bb38]; -+ _29 = <{async fn body of add()} as IntoFuture>::into_future(move _30) -> [return: bb13, unwind: bb29]; +- _29 = <{async fn body of add()} as IntoFuture>::into_future(move _30) -> [return: bb13, unwind: bb35]; ++ _29 = <{async fn body of add()} as IntoFuture>::into_future(move _30) -> [return: bb13, unwind: bb28]; } bb13: { @@ -289,8 +289,8 @@ - _38 = &mut _33; + _38 = &mut (((*_51) as variant#4).1: {async fn body of add()}); _37 = &mut (*_38); -- _36 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _37) -> [return: bb15, unwind: bb35]; -+ _36 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _37) -> [return: bb15, unwind: bb26]; +- _36 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _37) -> [return: bb15, unwind: bb31]; ++ _36 = Pin::<&mut {async fn body of add()}>::new_unchecked(move _37) -> [return: bb15, unwind: bb24]; } bb15: { @@ -299,7 +299,7 @@ StorageLive(_40); StorageLive(_41); - _41 = copy _2; -- _40 = std::future::get_context::<'_, '_>(move _41) -> [return: bb16, unwind: bb33]; +- _40 = std::future::get_context::<'_, '_>(move _41) -> [return: bb16, unwind: bb29]; + _41 = copy _52; + _40 = copy (_41.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb16; @@ -308,8 +308,8 @@ bb16: { _39 = &mut (*_40); StorageDead(_41); -- _35 = <{async fn body of add()} as Future>::poll(move _36, move _39) -> [return: bb17, unwind: bb34]; -+ _35 = <{async fn body of add()} as Future>::poll(move _36, move _39) -> [return: bb17, unwind: bb25]; +- _35 = <{async fn body of add()} as Future>::poll(move _36, move _39) -> [return: bb17, unwind: bb30]; ++ _35 = <{async fn body of add()} as Future>::poll(move _36, move _39) -> [return: bb17, unwind: bb23]; } bb17: { @@ -329,7 +329,7 @@ StorageLive(_45); StorageLive(_46); _46 = (); -- _45 = yield(move _46) -> [resume: bb20, drop: bb25]; +- _45 = yield(move _46) -> [resume: bb20, drop: bb23]; + _0 = Poll::::Pending; + StorageDead(_3); + StorageDead(_4); @@ -350,8 +350,8 @@ StorageDead(_43); StorageDead(_35); StorageDead(_34); -- drop(_33) -> [return: bb21, unwind: bb37]; -+ drop((((*_51) as variant#4).1: {async fn body of add()})) -> [return: bb21, unwind: bb28]; +- drop(_33) -> [return: bb21, unwind: bb33]; ++ drop((((*_51) as variant#4).1: {async fn body of add()})) -> [return: bb21, unwind: bb26]; } bb20: { @@ -371,15 +371,7 @@ StorageDead(_28); - StorageDead(_8); + nop; - goto -> bb22; - } - - bb22: { StorageDead(_29); - goto -> bb23; - } - - bb23: { StorageDead(_9); StorageLive(_47); _47 = copy (_7.0: u32); @@ -396,207 +388,181 @@ + nop; StorageDead(_4); StorageDead(_3); -- drop(_1) -> [return: bb24, unwind: bb52]; -+ goto -> bb24; +- drop(_1) -> [return: bb22, unwind: bb45]; ++ goto -> bb22; } - bb24: { + bb22: { + _0 = Poll::::Ready(move _49); + discriminant((*_51)) = 1; return; } -- bb25: { +- bb23: { - StorageDead(_46); - StorageDead(_45); -- drop(_33) -> [return: bb26, unwind: bb53]; +- drop(_33) -> [return: bb24, unwind: bb46]; - } - -- bb26: { +- bb24: { - StorageDead(_33); - StorageDead(_28); - StorageDead(_8); -- goto -> bb27; -- } -- -- bb27: { - StorageDead(_29); -- goto -> bb30; +- goto -> bb27; - } - -- bb28: { +- bb25: { - StorageDead(_27); - StorageDead(_26); -- drop(_13) -> [return: bb29, unwind: bb55]; +- drop(_13) -> [return: bb26, unwind: bb47]; - } - -- bb29: { +- bb26: { - StorageDead(_13); - StorageDead(_8); -- goto -> bb30; -- } -- -- bb30: { -- goto -> bb31; +- goto -> bb27; - } - -- bb31: { +- bb27: { - StorageDead(_9); - StorageDead(_7); - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb32, unwind: bb52]; +- drop(_1) -> [return: bb28, unwind: bb45]; - } - -- bb32: { +- bb28: { - coroutine_drop; - } - -- bb33 (cleanup): { +- bb29 (cleanup): { - StorageDead(_41); -- goto -> bb34; +- goto -> bb30; - } - -- bb34 (cleanup): { -+ bb25 (cleanup): { +- bb30 (cleanup): { ++ bb23 (cleanup): { StorageDead(_40); StorageDead(_39); -- goto -> bb36; -+ goto -> bb27; +- goto -> bb32; ++ goto -> bb25; } -- bb35 (cleanup): { -+ bb26 (cleanup): { +- bb31 (cleanup): { ++ bb24 (cleanup): { StorageDead(_37); -- goto -> bb36; -+ goto -> bb27; +- goto -> bb32; ++ goto -> bb25; } -- bb36 (cleanup): { -+ bb27 (cleanup): { +- bb32 (cleanup): { ++ bb25 (cleanup): { StorageDead(_38); StorageDead(_36); StorageDead(_35); StorageDead(_34); -- drop(_33) -> [return: bb37, unwind terminate(cleanup)]; -+ drop((((*_51) as variant#4).1: {async fn body of add()})) -> [return: bb28, unwind terminate(cleanup)]; +- drop(_33) -> [return: bb33, unwind terminate(cleanup)]; ++ drop((((*_51) as variant#4).1: {async fn body of add()})) -> [return: bb26, unwind terminate(cleanup)]; } -- bb37 (cleanup): { +- bb33 (cleanup): { - StorageDead(_33); -+ bb28 (cleanup): { ++ bb26 (cleanup): { + nop; StorageDead(_28); - StorageDead(_8); -- goto -> bb41; +- goto -> bb36; + nop; -+ goto -> bb32; - } - -- bb38 (cleanup): { -- goto -> bb40; -+ bb29 (cleanup): { -+ goto -> bb31; ++ goto -> bb29; } -- bb39 (cleanup): { -+ bb30 (cleanup): { +- bb34 (cleanup): { ++ bb27 (cleanup): { StorageDead(_32); StorageDead(_31); -- goto -> bb40; -+ goto -> bb31; +- goto -> bb35; ++ goto -> bb28; } -- bb40 (cleanup): { -+ bb31 (cleanup): { +- bb35 (cleanup): { ++ bb28 (cleanup): { StorageDead(_30); StorageDead(_28); - StorageDead(_8); -- goto -> bb41; +- goto -> bb36; + nop; -+ goto -> bb32; ++ goto -> bb29; } -- bb41 (cleanup): { -+ bb32 (cleanup): { +- bb36 (cleanup): { ++ bb29 (cleanup): { StorageDead(_29); -- goto -> bb47; -+ goto -> bb37; +- goto -> bb44; ++ goto -> bb36; } -- bb42 (cleanup): { +- bb37 (cleanup): { - StorageDead(_22); -- goto -> bb43; +- goto -> bb38; - } - -- bb43 (cleanup): { -+ bb33 (cleanup): { +- bb38 (cleanup): { ++ bb30 (cleanup): { StorageDead(_21); StorageDead(_20); -- goto -> bb45; -+ goto -> bb35; +- goto -> bb40; ++ goto -> bb32; } -- bb44 (cleanup): { -+ bb34 (cleanup): { +- bb39 (cleanup): { ++ bb31 (cleanup): { StorageDead(_18); -- goto -> bb45; -+ goto -> bb35; +- goto -> bb40; ++ goto -> bb32; } -- bb45 (cleanup): { -+ bb35 (cleanup): { +- bb40 (cleanup): { ++ bb32 (cleanup): { StorageDead(_19); StorageDead(_17); StorageDead(_16); StorageDead(_15); -- drop(_13) -> [return: bb46, unwind terminate(cleanup)]; -+ drop((((*_51) as variant#3).2: {async fn body of add()})) -> [return: bb36, unwind terminate(cleanup)]; +- drop(_13) -> [return: bb41, unwind terminate(cleanup)]; ++ drop((((*_51) as variant#3).2: {async fn body of add()})) -> [return: bb33, unwind terminate(cleanup)]; } -- bb46 (cleanup): { +- bb41 (cleanup): { - StorageDead(_13); - StorageDead(_8); -- goto -> bb47; -+ bb36 (cleanup): { +- goto -> bb44; ++ bb33 (cleanup): { + nop; + nop; -+ goto -> bb37; - } - -- bb47 (cleanup): { -- goto -> bb51; -+ bb37 (cleanup): { -+ goto -> bb41; - } - -- bb48 (cleanup): { -- goto -> bb50; -+ bb38 (cleanup): { -+ goto -> bb40; ++ goto -> bb36; } -- bb49 (cleanup): { -+ bb39 (cleanup): { +- bb42 (cleanup): { ++ bb34 (cleanup): { StorageDead(_12); StorageDead(_11); -- goto -> bb50; -+ goto -> bb40; +- goto -> bb43; ++ goto -> bb35; } -- bb50 (cleanup): { -+ bb40 (cleanup): { +- bb43 (cleanup): { ++ bb35 (cleanup): { StorageDead(_10); - StorageDead(_8); -- goto -> bb51; +- goto -> bb44; + nop; -+ goto -> bb41; ++ goto -> bb36; } -- bb51 (cleanup): { -+ bb41 (cleanup): { +- bb44 (cleanup): { ++ bb36 (cleanup): { StorageDead(_9); StorageDead(_7); - StorageDead(_6); @@ -605,26 +571,27 @@ + nop; StorageDead(_4); StorageDead(_3); -- drop(_1) -> [return: bb52, unwind terminate(cleanup)]; -+ goto -> bb42; +- drop(_1) -> [return: bb45, unwind terminate(cleanup)]; ++ goto -> bb37; } -- bb52 (cleanup): { -+ bb42 (cleanup): { -+ goto -> bb43; +- bb45 (cleanup): { ++ bb37 (cleanup): { ++ goto -> bb38; + } + -+ bb43 (cleanup): { ++ bb38 (cleanup): { + discriminant((*_51)) = 2; resume; } -- bb53 (cleanup): { +- bb46 (cleanup): { - StorageDead(_33); - StorageDead(_28); - StorageDead(_8); -- goto -> bb54; -+ bb44: { +- StorageDead(_29); +- goto -> bb48; ++ bb39: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_7); @@ -635,10 +602,11 @@ + goto -> bb10; } -- bb54 (cleanup): { -- StorageDead(_29); -- goto -> bb56; -+ bb45: { +- bb47 (cleanup): { +- StorageDead(_13); +- StorageDead(_8); +- goto -> bb48; ++ bb40: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_7); @@ -651,29 +619,23 @@ + goto -> bb20; } -- bb55 (cleanup): { -- StorageDead(_13); -- StorageDead(_8); -- goto -> bb56; -+ bb46: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb46, unwind continue]; - } - -- bb56 (cleanup): { -- goto -> bb57; -+ bb47: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb47, unwind continue]; - } - -- bb57 (cleanup): { +- bb48 (cleanup): { - StorageDead(_9); - StorageDead(_7); - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb52, unwind terminate(cleanup)]; -+ bb48: { +- drop(_1) -> [return: bb45, unwind terminate(cleanup)]; ++ bb41: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb41, unwind continue]; ++ } ++ ++ bb42: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb42, unwind continue]; ++ } ++ ++ bb43: { + StorageLive(_3); + _3 = copy ((*_51).0: u32); + StorageLive(_4); @@ -690,7 +652,7 @@ + _11 = copy _3; + StorageLive(_12); + _12 = copy _4; -+ _10 = add(move _11, move _12) -> [return: bb1, unwind: bb39]; ++ _10 = add(move _11, move _12) -> [return: bb1, unwind: bb34]; } } diff --git a/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.coroutine_drop.0.mir index d107b3a2dbbbd..4caf2bdbc3c1a 100644 --- a/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.build_aggregate-{closure#0}.coroutine_drop.0.mir @@ -86,112 +86,96 @@ fn build_aggregate::{closure#0}(_1: &mut {async fn body of build_aggregate()}) - bb0: { _50 = discriminant((*_1)); - switchInt(move _50) -> [0: bb16, 3: bb17, 4: bb18, otherwise: bb19]; + switchInt(move _50) -> [0: bb12, 3: bb13, 4: bb14, otherwise: bb15]; } bb1: { StorageDead(_46); StorageDead(_45); - drop((((*_1) as variant#4).1: {async fn body of add()})) -> [return: bb2, unwind: bb10]; + drop((((*_1) as variant#4).1: {async fn body of add()})) -> [return: bb2, unwind: bb8]; } bb2: { nop; StorageDead(_28); nop; - goto -> bb3; - } - - bb3: { StorageDead(_29); - goto -> bb6; + goto -> bb5; } - bb4: { + bb3: { StorageDead(_27); StorageDead(_26); - drop((((*_1) as variant#3).2: {async fn body of add()})) -> [return: bb5, unwind: bb12]; + drop((((*_1) as variant#3).2: {async fn body of add()})) -> [return: bb4, unwind: bb9]; } - bb5: { + bb4: { nop; nop; - goto -> bb6; - } - - bb6: { - goto -> bb7; + goto -> bb5; } - bb7: { + bb5: { StorageDead(_9); StorageDead(_7); nop; nop; StorageDead(_4); StorageDead(_3); - goto -> bb8; + goto -> bb6; } - bb8: { + bb6: { return; } - bb9 (cleanup): { + bb7 (cleanup): { resume; } - bb10 (cleanup): { + bb8 (cleanup): { nop; StorageDead(_28); nop; - goto -> bb11; - } - - bb11 (cleanup): { StorageDead(_29); - goto -> bb13; + goto -> bb10; } - bb12 (cleanup): { + bb9 (cleanup): { nop; nop; - goto -> bb13; + goto -> bb10; } - bb13 (cleanup): { - goto -> bb14; - } - - bb14 (cleanup): { + bb10 (cleanup): { StorageDead(_9); StorageDead(_7); nop; nop; StorageDead(_4); StorageDead(_3); - goto -> bb9; + goto -> bb7; } - bb15: { + bb11: { return; } - bb16: { - goto -> bb15; + bb12: { + goto -> bb11; } - bb17: { + bb13: { StorageLive(_3); StorageLive(_4); StorageLive(_7); StorageLive(_9); StorageLive(_26); StorageLive(_27); - goto -> bb4; + goto -> bb3; } - bb18: { + bb14: { StorageLive(_3); StorageLive(_4); StorageLive(_7); @@ -203,7 +187,7 @@ fn build_aggregate::{closure#0}(_1: &mut {async fn body of build_aggregate()}) - goto -> bb1; } - bb19: { + bb15: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.StateTransform.diff index e2a229fc36c73..c385b56d50288 100644 --- a/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.StateTransform.diff @@ -123,12 +123,12 @@ - _10 = {coroutine@$DIR/async_fn.rs:21:13: 21:18 (#0)} { y: move _11, z: move _12 }; - StorageDead(_12); - StorageDead(_11); -- _9 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as IntoFuture>::into_future(move _10) -> [return: bb1, unwind: bb22]; +- _9 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as IntoFuture>::into_future(move _10) -> [return: bb1, unwind: bb20]; + _39 = move _2 as std::ptr::NonNull> (Transmute); + _38 = std::future::ResumeTy(move _39); + _36 = copy (_1.0: &mut {async fn body of foo()}); + _35 = discriminant((*_36)); -+ switchInt(move _35) -> [0: bb25, 1: bb24, 2: bb23, 3: bb22, otherwise: bb6]; ++ switchInt(move _35) -> [0: bb23, 1: bb22, 2: bb21, 3: bb20, otherwise: bb6]; } bb1: { @@ -150,8 +150,8 @@ - _19 = &mut _13; + _19 = &mut (((*_36) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18}); _18 = &mut (*_19); -- _17 = Pin::<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>::new_unchecked(move _18) -> [return: bb3, unwind: bb19]; -+ _17 = Pin::<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>::new_unchecked(move _18) -> [return: bb3, unwind: bb14]; +- _17 = Pin::<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>::new_unchecked(move _18) -> [return: bb3, unwind: bb17]; ++ _17 = Pin::<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>::new_unchecked(move _18) -> [return: bb3, unwind: bb13]; } bb3: { @@ -160,7 +160,7 @@ StorageLive(_21); StorageLive(_22); - _22 = copy _2; -- _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb4, unwind: bb17]; +- _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb4, unwind: bb15]; + _22 = copy _38; + _21 = copy (_22.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb4; @@ -169,8 +169,8 @@ bb4: { _20 = &mut (*_21); StorageDead(_22); -- _16 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as Future>::poll(move _17, move _20) -> [return: bb5, unwind: bb18]; -+ _16 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as Future>::poll(move _17, move _20) -> [return: bb5, unwind: bb13]; +- _16 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as Future>::poll(move _17, move _20) -> [return: bb5, unwind: bb16]; ++ _16 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as Future>::poll(move _17, move _20) -> [return: bb5, unwind: bb12]; } bb5: { @@ -194,7 +194,7 @@ StorageLive(_26); StorageLive(_27); _27 = (); -- _26 = yield(move _27) -> [resume: bb9, drop: bb13]; +- _26 = yield(move _27) -> [resume: bb9, drop: bb12]; + _0 = Poll::::Pending; + StorageDead(_5); + StorageDead(_7); @@ -213,8 +213,8 @@ StorageDead(_24); StorageDead(_16); StorageDead(_15); -- drop(_13) -> [return: bb10, unwind: bb21]; -+ drop((((*_36) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb10, unwind: bb16]; +- drop(_13) -> [return: bb10, unwind: bb19]; ++ drop((((*_36) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb10, unwind: bb15]; } bb9: { @@ -229,10 +229,6 @@ bb10: { - StorageDead(_13); + nop; - goto -> bb11; - } - - bb11: { StorageDead(_9); StorageLive(_28); _28 = const 10_u32; @@ -263,36 +259,30 @@ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb12, unwind: bb25]; +- drop(_1) -> [return: bb11, unwind: bb22]; + nop; + nop; -+ goto -> bb12; ++ goto -> bb11; } - bb12: { + bb11: { + _0 = Poll::::Ready(move _34); + discriminant((*_36)) = 1; return; } -- bb13: { +- bb12: { - StorageDead(_27); - StorageDead(_26); -- drop(_13) -> [return: bb14, unwind: bb26]; -+ bb13 (cleanup): { +- drop(_13) -> [return: bb13, unwind: bb23]; ++ bb12 (cleanup): { + StorageDead(_21); + StorageDead(_20); -+ goto -> bb15; ++ goto -> bb14; } -- bb14: { +- bb13: { - StorageDead(_13); -+ bb14 (cleanup): { -+ StorageDead(_18); - goto -> bb15; - } - -- bb15: { - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); @@ -300,36 +290,38 @@ - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb16, unwind: bb25]; -+ bb15 (cleanup): { +- drop(_1) -> [return: bb14, unwind: bb22]; ++ bb13 (cleanup): { ++ StorageDead(_18); ++ goto -> bb14; + } + +- bb14: { +- coroutine_drop; ++ bb14 (cleanup): { + StorageDead(_19); + StorageDead(_17); + StorageDead(_16); + StorageDead(_15); -+ drop((((*_36) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb16, unwind terminate(cleanup)]; ++ drop((((*_36) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb15, unwind terminate(cleanup)]; } -- bb16: { -- coroutine_drop; -+ bb16 (cleanup): { -+ nop; -+ goto -> bb19; - } - - bb17 (cleanup): { + bb15 (cleanup): { - StorageDead(_22); - goto -> bb18; +- goto -> bb16; ++ nop; ++ goto -> bb17; } - bb18 (cleanup): { + bb16 (cleanup): { - StorageDead(_21); - StorageDead(_20); -- goto -> bb20; +- goto -> bb18; + StorageDead(_10); -+ goto -> bb19; ++ goto -> bb17; } - bb19 (cleanup): { + bb17 (cleanup): { - StorageDead(_18); + StorageDead(_9); + StorageDead(_8); @@ -338,28 +330,29 @@ + StorageDead(_5); + nop; + nop; - goto -> bb20; + goto -> bb18; } - bb20 (cleanup): { + bb18 (cleanup): { - StorageDead(_19); - StorageDead(_17); - StorageDead(_16); - StorageDead(_15); -- drop(_13) -> [return: bb21, unwind terminate(cleanup)]; -+ goto -> bb21; +- drop(_13) -> [return: bb19, unwind terminate(cleanup)]; ++ goto -> bb19; } - bb21 (cleanup): { + bb19 (cleanup): { - StorageDead(_13); -- goto -> bb24; +- goto -> bb21; + discriminant((*_36)) = 2; + resume; } -- bb22 (cleanup): { -- goto -> bb23; -+ bb22: { +- bb20 (cleanup): { +- StorageDead(_10); +- goto -> bb21; ++ bb20: { + StorageLive(_5); + StorageLive(_7); + StorageLive(_8); @@ -370,14 +363,7 @@ + goto -> bb9; } -- bb23 (cleanup): { -- StorageDead(_10); -- goto -> bb24; -+ bb23: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb23, unwind continue]; - } - -- bb24 (cleanup): { +- bb21 (cleanup): { - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); @@ -385,21 +371,19 @@ - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb25, unwind terminate(cleanup)]; -+ bb24: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb24, unwind continue]; +- drop(_1) -> [return: bb22, unwind terminate(cleanup)]; ++ bb21: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb21, unwind continue]; } -- bb25 (cleanup): { +- bb22 (cleanup): { - resume; -- } -- -- bb26 (cleanup): { ++ bb22: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb22, unwind continue]; + } + +- bb23 (cleanup): { - StorageDead(_13); -- goto -> bb27; -- } -- -- bb27 (cleanup): { - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); @@ -407,8 +391,8 @@ - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb25, unwind terminate(cleanup)]; -+ bb25: { +- drop(_1) -> [return: bb22, unwind terminate(cleanup)]; ++ bb23: { + nop; + (((*_36) as variant#3).0: &u32) = copy ((*_36).0: &u32); + nop; @@ -429,7 +413,7 @@ + _10 = {coroutine@$DIR/async_fn.rs:21:13: 21:18 (#0)} { y: move _11, z: move _12 }; + StorageDead(_12); + StorageDead(_11); -+ _9 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as IntoFuture>::into_future(move _10) -> [return: bb1, unwind: bb17]; ++ _9 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as IntoFuture>::into_future(move _10) -> [return: bb1, unwind: bb16]; } } diff --git a/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.coroutine_drop.0.mir index d5d9182fb2071..567ea5fc75556 100644 --- a/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.foo-{closure#0}.coroutine_drop.0.mir @@ -72,21 +72,17 @@ fn foo::{closure#0}(_1: &mut {async fn body of foo()}) -> () { bb0: { _35 = discriminant((*_1)); - switchInt(move _35) -> [0: bb9, 3: bb10, otherwise: bb11]; + switchInt(move _35) -> [0: bb7, 3: bb8, otherwise: bb9]; } bb1: { StorageDead(_27); StorageDead(_26); - drop((((*_1) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb2, unwind: bb6]; + drop((((*_1) as variant#3).3: {async block@$DIR/async_fn.rs:21:13: 21:18})) -> [return: bb2, unwind: bb5]; } bb2: { nop; - goto -> bb3; - } - - bb3: { StorageDead(_9); StorageDead(_8); StorageDead(_7); @@ -94,23 +90,19 @@ fn foo::{closure#0}(_1: &mut {async fn body of foo()}) -> () { StorageDead(_5); nop; nop; - goto -> bb4; + goto -> bb3; } - bb4: { + bb3: { return; } - bb5 (cleanup): { + bb4 (cleanup): { resume; } - bb6 (cleanup): { + bb5 (cleanup): { nop; - goto -> bb7; - } - - bb7 (cleanup): { StorageDead(_9); StorageDead(_8); StorageDead(_7); @@ -118,18 +110,18 @@ fn foo::{closure#0}(_1: &mut {async fn body of foo()}) -> () { StorageDead(_5); nop; nop; - goto -> bb5; + goto -> bb4; } - bb8: { + bb6: { return; } - bb9: { - goto -> bb8; + bb7: { + goto -> bb6; } - bb10: { + bb8: { StorageLive(_5); StorageLive(_7); StorageLive(_8); @@ -139,7 +131,7 @@ fn foo::{closure#0}(_1: &mut {async fn body of foo()}) -> () { goto -> bb1; } - bb11: { + bb9: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.StateTransform.diff index 5707f3dcd4439..b4df186acbf56 100644 --- a/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.StateTransform.diff @@ -90,12 +90,12 @@ - _6 = &_3; - StorageLive(_7); - _7 = RangeFull; -- _5 = <[u8; 1] as Index>::index(move _6, move _7) -> [return: bb1, unwind: bb30]; +- _5 = <[u8; 1] as Index>::index(move _6, move _7) -> [return: bb1, unwind: bb27]; + _37 = move _2 as std::ptr::NonNull> (Transmute); + _36 = std::future::ResumeTy(move _37); + _35 = copy (_1.0: &mut {async fn body of hello_world()}); + _34 = discriminant((*_35)); -+ switchInt(move _34) -> [0: bb32, 1: bb31, 2: bb30, 3: bb29, otherwise: bb8]; ++ switchInt(move _34) -> [0: bb30, 1: bb29, 2: bb28, 3: bb27, otherwise: bb8]; } bb1: { @@ -124,14 +124,14 @@ _16 = &mut (*_17); _15 = move _16 as &mut [u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_16); -- _12 = read_exact(move _13, move _15) -> [return: bb2, unwind: bb27]; -+ _12 = read_exact(move _13, move _15) -> [return: bb2, unwind: bb22]; +- _12 = read_exact(move _13, move _15) -> [return: bb2, unwind: bb24]; ++ _12 = read_exact(move _13, move _15) -> [return: bb2, unwind: bb20]; } bb2: { StorageDead(_15); StorageDead(_13); -- _11 = <{async fn body of read_exact()} as IntoFuture>::into_future(move _12) -> [return: bb3, unwind: bb26]; +- _11 = <{async fn body of read_exact()} as IntoFuture>::into_future(move _12) -> [return: bb3, unwind: bb25]; + _11 = <{async fn body of read_exact()} as IntoFuture>::into_future(move _12) -> [return: bb3, unwind: bb21]; } @@ -154,8 +154,8 @@ - _24 = &mut _18; + _24 = &mut (((*_35) as variant#3).3: {async fn body of read_exact()}); _23 = &mut (*_24); -- _22 = Pin::<&mut {async fn body of read_exact()}>::new_unchecked(move _23) -> [return: bb5, unwind: bb22]; -+ _22 = Pin::<&mut {async fn body of read_exact()}>::new_unchecked(move _23) -> [return: bb5, unwind: bb17]; +- _22 = Pin::<&mut {async fn body of read_exact()}>::new_unchecked(move _23) -> [return: bb5, unwind: bb20]; ++ _22 = Pin::<&mut {async fn body of read_exact()}>::new_unchecked(move _23) -> [return: bb5, unwind: bb16]; } bb5: { @@ -164,7 +164,7 @@ StorageLive(_26); StorageLive(_27); - _27 = copy _2; -- _26 = std::future::get_context::<'_, '_>(move _27) -> [return: bb6, unwind: bb20]; +- _26 = std::future::get_context::<'_, '_>(move _27) -> [return: bb6, unwind: bb18]; + _27 = copy _36; + _26 = copy (_27.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb6; @@ -173,8 +173,8 @@ bb6: { _25 = &mut (*_26); StorageDead(_27); -- _21 = <{async fn body of read_exact()} as Future>::poll(move _22, move _25) -> [return: bb7, unwind: bb21]; -+ _21 = <{async fn body of read_exact()} as Future>::poll(move _22, move _25) -> [return: bb7, unwind: bb16]; +- _21 = <{async fn body of read_exact()} as Future>::poll(move _22, move _25) -> [return: bb7, unwind: bb19]; ++ _21 = <{async fn body of read_exact()} as Future>::poll(move _22, move _25) -> [return: bb7, unwind: bb15]; } bb7: { @@ -198,7 +198,7 @@ StorageLive(_31); StorageLive(_32); _32 = (); -- _31 = yield(move _32) -> [resume: bb11, drop: bb16]; +- _31 = yield(move _32) -> [resume: bb11, drop: bb15]; + _0 = Poll::<()>::Pending; + StorageDead(_5); + StorageDead(_9); @@ -219,8 +219,8 @@ StorageDead(_29); StorageDead(_21); StorageDead(_20); -- drop(_18) -> [return: bb12, unwind: bb24]; -+ drop((((*_35) as variant#3).3: {async fn body of read_exact()})) -> [return: bb12, unwind: bb19]; +- drop(_18) -> [return: bb12, unwind: bb22]; ++ drop((((*_35) as variant#3).3: {async fn body of read_exact()})) -> [return: bb12, unwind: bb18]; } bb11: { @@ -234,17 +234,13 @@ bb12: { - StorageDead(_18); -- _9 = Option::<()>::unwrap(move _10) -> [return: bb13, unwind: bb25]; +- _9 = Option::<()>::unwrap(move _10) -> [return: bb13, unwind: bb23]; + nop; -+ _9 = Option::<()>::unwrap(move _10) -> [return: bb13, unwind: bb20]; ++ _9 = Option::<()>::unwrap(move _10) -> [return: bb13, unwind: bb19]; } bb13: { StorageDead(_10); - goto -> bb14; - } - - bb14: { StorageDead(_17); StorageDead(_14); StorageDead(_11); @@ -256,31 +252,31 @@ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb15, unwind: bb32]; +- drop(_1) -> [return: bb14, unwind: bb29]; + nop; + nop; -+ goto -> bb15; ++ goto -> bb14; } - bb15: { + bb14: { + _0 = Poll::<()>::Ready(move _33); + discriminant((*_35)) = 1; return; } -- bb16: { +- bb15: { - StorageDead(_32); - StorageDead(_31); -- drop(_18) -> [return: bb17, unwind: bb33]; -- } -- -- bb17: { +- drop(_18) -> [return: bb16, unwind: bb30]; ++ bb15 (cleanup): { ++ StorageDead(_26); ++ StorageDead(_25); ++ goto -> bb17; + } + +- bb16: { - StorageDead(_18); - StorageDead(_10); -- goto -> bb18; -- } -- -- bb18: { - StorageDead(_17); - StorageDead(_14); - StorageDead(_11); @@ -289,126 +285,104 @@ - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb19, unwind: bb32]; -- } -- -- bb19: { -- coroutine_drop; -- } -- -- bb20 (cleanup): { -- StorageDead(_27); -- goto -> bb21; -- } -- -- bb21 (cleanup): { +- drop(_1) -> [return: bb17, unwind: bb29]; + bb16 (cleanup): { - StorageDead(_26); - StorageDead(_25); -- goto -> bb23; -+ goto -> bb18; ++ StorageDead(_23); ++ goto -> bb17; } -- bb22 (cleanup): { +- bb17: { +- coroutine_drop; + bb17 (cleanup): { - StorageDead(_23); -- goto -> bb23; -+ goto -> bb18; - } - -- bb23 (cleanup): { -+ bb18 (cleanup): { - StorageDead(_24); - StorageDead(_22); - StorageDead(_21); - StorageDead(_20); -- drop(_18) -> [return: bb24, unwind terminate(cleanup)]; -+ drop((((*_35) as variant#3).3: {async fn body of read_exact()})) -> [return: bb19, unwind terminate(cleanup)]; ++ StorageDead(_24); ++ StorageDead(_22); ++ StorageDead(_21); ++ StorageDead(_20); ++ drop((((*_35) as variant#3).3: {async fn body of read_exact()})) -> [return: bb18, unwind terminate(cleanup)]; } -- bb24 (cleanup): { -- StorageDead(_18); -- goto -> bb25; -+ bb19 (cleanup): { + bb18 (cleanup): { +- StorageDead(_27); + nop; -+ goto -> bb20; - } - -- bb25 (cleanup): { -+ bb20 (cleanup): { - StorageDead(_10); -- goto -> bb29; -+ goto -> bb24; + goto -> bb19; } -- bb26 (cleanup): { -- goto -> bb28; -+ bb21 (cleanup): { -+ goto -> bb23; + bb19 (cleanup): { +- StorageDead(_26); +- StorageDead(_25); +- goto -> bb21; ++ StorageDead(_10); ++ goto -> bb22; } -- bb27 (cleanup): { -+ bb22 (cleanup): { - StorageDead(_15); - StorageDead(_13); -- goto -> bb28; -+ goto -> bb23; + bb20 (cleanup): { +- StorageDead(_23); ++ StorageDead(_15); ++ StorageDead(_13); + goto -> bb21; } -- bb28 (cleanup): { -+ bb23 (cleanup): { - StorageDead(_12); - StorageDead(_10); -- goto -> bb29; -+ goto -> bb24; + bb21 (cleanup): { +- StorageDead(_24); +- StorageDead(_22); +- StorageDead(_21); +- StorageDead(_20); +- drop(_18) -> [return: bb22, unwind terminate(cleanup)]; ++ StorageDead(_12); ++ StorageDead(_10); ++ goto -> bb22; } -- bb29 (cleanup): { -+ bb24 (cleanup): { - StorageDead(_17); - StorageDead(_14); - StorageDead(_11); - StorageDead(_9); -- StorageDead(_8); -- goto -> bb31; + bb22 (cleanup): { +- StorageDead(_18); +- goto -> bb23; ++ StorageDead(_17); ++ StorageDead(_14); ++ StorageDead(_11); ++ StorageDead(_9); + nop; -+ goto -> bb26; ++ goto -> bb24; } -- bb30 (cleanup): { -+ bb25 (cleanup): { - StorageDead(_7); - StorageDead(_6); -- goto -> bb31; -+ goto -> bb26; + bb23 (cleanup): { +- StorageDead(_10); +- goto -> bb26; ++ StorageDead(_7); ++ StorageDead(_6); ++ goto -> bb24; } -- bb31 (cleanup): { -+ bb26 (cleanup): { - StorageDead(_5); -- StorageDead(_4); -- StorageDead(_3); -- drop(_1) -> [return: bb32, unwind terminate(cleanup)]; + bb24 (cleanup): { +- StorageDead(_15); +- StorageDead(_13); ++ StorageDead(_5); + nop; + nop; -+ goto -> bb27; + goto -> bb25; } -- bb32 (cleanup): { -+ bb27 (cleanup): { -+ goto -> bb28; -+ } -+ -+ bb28 (cleanup): { + bb25 (cleanup): { +- StorageDead(_12); +- StorageDead(_10); + goto -> bb26; + } + + bb26 (cleanup): { +- StorageDead(_17); +- StorageDead(_14); +- StorageDead(_11); +- StorageDead(_9); +- StorageDead(_8); +- goto -> bb28; + discriminant((*_35)) = 2; - resume; ++ resume; } -- bb33 (cleanup): { -- StorageDead(_18); -- StorageDead(_10); -- goto -> bb34; -+ bb29: { +- bb27 (cleanup): { +- StorageDead(_7); +- StorageDead(_6); +- goto -> bb28; ++ bb27: { + StorageLive(_5); + StorageLive(_9); + StorageLive(_10); @@ -421,7 +395,24 @@ + goto -> bb11; } -- bb34 (cleanup): { +- bb28 (cleanup): { +- StorageDead(_5); +- StorageDead(_4); +- StorageDead(_3); +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb28: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb28, unwind continue]; + } + +- bb29 (cleanup): { +- resume; ++ bb29: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind continue]; + } + +- bb30 (cleanup): { +- StorageDead(_18); +- StorageDead(_10); - StorageDead(_17); - StorageDead(_14); - StorageDead(_11); @@ -430,16 +421,8 @@ - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb32, unwind terminate(cleanup)]; +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; + bb30: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb30, unwind continue]; -+ } -+ -+ bb31: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb31, unwind continue]; -+ } -+ -+ bb32: { + nop; + (((*_35) as variant#3).0: [u8; 1]) = [const 0_u8; 1]; + nop; @@ -448,7 +431,7 @@ + _6 = &(((*_35) as variant#3).0: [u8; 1]); + StorageLive(_7); + _7 = RangeFull; -+ _5 = <[u8; 1] as Index>::index(move _6, move _7) -> [return: bb1, unwind: bb25]; ++ _5 = <[u8; 1] as Index>::index(move _6, move _7) -> [return: bb1, unwind: bb23]; } } diff --git a/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.coroutine_drop.0.mir index b32943d88c10f..0ea9874507793 100644 --- a/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.hello_world-{closure#0}.coroutine_drop.0.mir @@ -54,22 +54,18 @@ fn hello_world::{closure#0}(_1: &mut {async fn body of hello_world()}) -> () { bb0: { _34 = discriminant((*_1)); - switchInt(move _34) -> [0: bb9, 3: bb10, otherwise: bb11]; + switchInt(move _34) -> [0: bb7, 3: bb8, otherwise: bb9]; } bb1: { StorageDead(_32); StorageDead(_31); - drop((((*_1) as variant#3).3: {async fn body of read_exact()})) -> [return: bb2, unwind: bb6]; + drop((((*_1) as variant#3).3: {async fn body of read_exact()})) -> [return: bb2, unwind: bb5]; } bb2: { nop; StorageDead(_10); - goto -> bb3; - } - - bb3: { StorageDead(_17); StorageDead(_14); StorageDead(_11); @@ -78,24 +74,20 @@ fn hello_world::{closure#0}(_1: &mut {async fn body of hello_world()}) -> () { StorageDead(_5); nop; nop; - goto -> bb4; + goto -> bb3; } - bb4: { + bb3: { return; } - bb5 (cleanup): { + bb4 (cleanup): { resume; } - bb6 (cleanup): { + bb5 (cleanup): { nop; StorageDead(_10); - goto -> bb7; - } - - bb7 (cleanup): { StorageDead(_17); StorageDead(_14); StorageDead(_11); @@ -104,18 +96,18 @@ fn hello_world::{closure#0}(_1: &mut {async fn body of hello_world()}) -> () { StorageDead(_5); nop; nop; - goto -> bb5; + goto -> bb4; } - bb8: { + bb6: { return; } - bb9: { - goto -> bb8; + bb7: { + goto -> bb6; } - bb10: { + bb8: { StorageLive(_5); StorageLive(_9); StorageLive(_10); @@ -127,7 +119,7 @@ fn hello_world::{closure#0}(_1: &mut {async fn body of hello_world()}) -> () { goto -> bb1; } - bb11: { + bb9: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.StateTransform.diff index 47aeaec0fa8fd..6008fabd19b77 100644 --- a/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.StateTransform.diff @@ -120,12 +120,12 @@ - _8 = &_4; - _7 = {coroutine@$DIR/async_fn.rs:61:18: 61:23 (#0)} { x: move _8 }; - StorageDead(_8); -- _6 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as IntoFuture>::into_future(move _7) -> [return: bb1, unwind: bb25]; +- _6 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as IntoFuture>::into_future(move _7) -> [return: bb1, unwind: bb23]; + _52 = move _2 as std::ptr::NonNull> (Transmute); + _51 = std::future::ResumeTy(move _52); + _50 = copy (_1.0: &mut {async fn body of includes_never()}); + _49 = discriminant((*_50)); -+ switchInt(move _49) -> [0: bb29, 1: bb28, 2: bb27, 3: bb26, otherwise: bb6]; ++ switchInt(move _49) -> [0: bb27, 1: bb26, 2: bb25, 3: bb24, otherwise: bb6]; } bb1: { @@ -147,8 +147,8 @@ - _15 = &mut _9; + _15 = &mut (((*_50) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23}); _14 = &mut (*_15); -- _13 = Pin::<&mut {async block@$DIR/async_fn.rs:61:18: 61:23}>::new_unchecked(move _14) -> [return: bb3, unwind: bb22]; -+ _13 = Pin::<&mut {async block@$DIR/async_fn.rs:61:18: 61:23}>::new_unchecked(move _14) -> [return: bb3, unwind: bb17]; +- _13 = Pin::<&mut {async block@$DIR/async_fn.rs:61:18: 61:23}>::new_unchecked(move _14) -> [return: bb3, unwind: bb20]; ++ _13 = Pin::<&mut {async block@$DIR/async_fn.rs:61:18: 61:23}>::new_unchecked(move _14) -> [return: bb3, unwind: bb16]; } bb3: { @@ -157,7 +157,7 @@ StorageLive(_17); StorageLive(_18); - _18 = copy _2; -- _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb4, unwind: bb20]; +- _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb4, unwind: bb18]; + _18 = copy _51; + _17 = copy (_18.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb4; @@ -166,8 +166,8 @@ bb4: { _16 = &mut (*_17); StorageDead(_18); -- _12 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as Future>::poll(move _13, move _16) -> [return: bb5, unwind: bb21]; -+ _12 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as Future>::poll(move _13, move _16) -> [return: bb5, unwind: bb16]; +- _12 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as Future>::poll(move _13, move _16) -> [return: bb5, unwind: bb19]; ++ _12 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as Future>::poll(move _13, move _16) -> [return: bb5, unwind: bb15]; } bb5: { @@ -191,7 +191,7 @@ StorageLive(_22); StorageLive(_23); _23 = (); -- _22 = yield(move _23) -> [resume: bb9, drop: bb15]; +- _22 = yield(move _23) -> [resume: bb9, drop: bb14]; + _0 = Poll::::Pending; + StorageDead(_5); + StorageDead(_6); @@ -208,8 +208,8 @@ StorageDead(_20); StorageDead(_12); StorageDead(_11); -- drop(_9) -> [return: bb10, unwind: bb24]; -+ drop((((*_50) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb10, unwind: bb19]; +- drop(_9) -> [return: bb10, unwind: bb22]; ++ drop((((*_50) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb10, unwind: bb18]; } bb9: { @@ -224,16 +224,21 @@ bb10: { - StorageDead(_9); + nop; - goto -> bb11; - } - - bb11: { StorageDead(_6); StorageLive(_24); StorageLive(_25); - _25 = copy _3; + _25 = copy (((*_50) as variant#3).0: bool); - switchInt(move _25) -> [0: bb12, otherwise: bb13]; + switchInt(move _25) -> [0: bb12, otherwise: bb11]; + } + + bb11: { + _24 = const (); + StorageDead(_25); + StorageDead(_24); + StorageLive(_27); +- _27 = never() -> bb17; ++ _27 = never() -> bb14; } bb12: { @@ -244,120 +249,107 @@ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb14, unwind: bb29]; +- drop(_1) -> [return: bb13, unwind: bb26]; + nop; + nop; -+ goto -> bb14; ++ goto -> bb13; } bb13: { - _24 = const (); - StorageDead(_25); - StorageDead(_24); - StorageLive(_27); -- _27 = never() -> bb19; -+ _27 = never() -> bb15; - } - - bb14: { + _0 = Poll::::Ready(move _48); + discriminant((*_50)) = 1; return; } -- bb15: { +- bb14: { - StorageDead(_23); - StorageDead(_22); -- drop(_9) -> [return: bb16, unwind: bb30]; -+ bb15 (cleanup): { +- drop(_9) -> [return: bb15, unwind: bb27]; ++ bb14 (cleanup): { + StorageDead(_27); -+ goto -> bb23; ++ goto -> bb21; } -- bb16: { +- bb15: { - StorageDead(_9); -- goto -> bb17; -+ bb16 (cleanup): { -+ StorageDead(_17); -+ StorageDead(_16); -+ goto -> bb18; - } - -- bb17: { - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb18, unwind: bb29]; -+ bb17 (cleanup): { -+ StorageDead(_14); -+ goto -> bb18; +- drop(_1) -> [return: bb16, unwind: bb26]; ++ bb15 (cleanup): { ++ StorageDead(_17); ++ StorageDead(_16); ++ goto -> bb17; } -- bb18: { +- bb16: { - coroutine_drop; -+ bb18 (cleanup): { ++ bb16 (cleanup): { ++ StorageDead(_14); ++ goto -> bb17; + } + + bb17 (cleanup): { +- StorageDead(_27); +- goto -> bb25; + StorageDead(_15); + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); -+ drop((((*_50) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb19, unwind terminate(cleanup)]; ++ drop((((*_50) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb18, unwind terminate(cleanup)]; } - bb19 (cleanup): { -- StorageDead(_27); -- goto -> bb28; -+ nop; -+ goto -> bb22; - } - - bb20 (cleanup): { + bb18 (cleanup): { - StorageDead(_18); - goto -> bb21; +- goto -> bb19; ++ nop; ++ goto -> bb20; } - bb21 (cleanup): { + bb19 (cleanup): { - StorageDead(_17); - StorageDead(_16); -- goto -> bb23; +- goto -> bb21; + StorageDead(_7); -+ goto -> bb22; ++ goto -> bb20; } - bb22 (cleanup): { + bb20 (cleanup): { - StorageDead(_14); + StorageDead(_6); - goto -> bb23; + goto -> bb21; } - bb23 (cleanup): { + bb21 (cleanup): { - StorageDead(_15); - StorageDead(_13); - StorageDead(_12); - StorageDead(_11); -- drop(_9) -> [return: bb24, unwind terminate(cleanup)]; +- drop(_9) -> [return: bb22, unwind terminate(cleanup)]; + StorageDead(_5); + nop; + nop; -+ goto -> bb24; ++ goto -> bb22; } - bb24 (cleanup): { + bb22 (cleanup): { - StorageDead(_9); -- goto -> bb27; -+ goto -> bb25; +- goto -> bb24; ++ goto -> bb23; } - bb25 (cleanup): { -- goto -> bb26; + bb23 (cleanup): { +- StorageDead(_7); +- goto -> bb24; + discriminant((*_50)) = 2; + resume; } -- bb26 (cleanup): { -- StorageDead(_7); -- goto -> bb27; -+ bb26: { +- bb24 (cleanup): { +- StorageDead(_6); +- goto -> bb25; ++ bb24: { + StorageLive(_5); + StorageLive(_6); + StorageLive(_22); @@ -366,38 +358,29 @@ + goto -> bb9; } -- bb27 (cleanup): { -- StorageDead(_6); -- goto -> bb28; -+ bb27: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb27, unwind continue]; - } - -- bb28 (cleanup): { +- bb25 (cleanup): { - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; -+ bb28: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind continue]; +- drop(_1) -> [return: bb26, unwind terminate(cleanup)]; ++ bb25: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb25, unwind continue]; } -- bb29 (cleanup): { +- bb26 (cleanup): { - resume; -- } -- -- bb30 (cleanup): { ++ bb26: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb26, unwind continue]; + } + +- bb27 (cleanup): { - StorageDead(_9); -- goto -> bb31; -- } -- -- bb31 (cleanup): { - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; -+ bb29: { +- drop(_1) -> [return: bb26, unwind terminate(cleanup)]; ++ bb27: { + nop; + (((*_50) as variant#3).0: bool) = copy ((*_50).0: bool); + nop; @@ -409,7 +392,7 @@ + _8 = &(((*_50) as variant#3).1: u32); + _7 = {coroutine@$DIR/async_fn.rs:61:18: 61:23 (#0)} { x: move _8 }; + StorageDead(_8); -+ _6 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as IntoFuture>::into_future(move _7) -> [return: bb1, unwind: bb20]; ++ _6 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as IntoFuture>::into_future(move _7) -> [return: bb1, unwind: bb19]; } } diff --git a/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.coroutine_drop.0.mir index 97fdec425898f..66219d34f2a7a 100644 --- a/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.includes_never-{closure#0}.coroutine_drop.0.mir @@ -82,58 +82,50 @@ fn includes_never::{closure#0}(_1: &mut {async fn body of includes_never()}) -> bb0: { _49 = discriminant((*_1)); - switchInt(move _49) -> [0: bb9, 3: bb10, otherwise: bb11]; + switchInt(move _49) -> [0: bb7, 3: bb8, otherwise: bb9]; } bb1: { StorageDead(_23); StorageDead(_22); - drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb2, unwind: bb6]; + drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:61:18: 61:23})) -> [return: bb2, unwind: bb5]; } bb2: { nop; - goto -> bb3; - } - - bb3: { StorageDead(_6); StorageDead(_5); nop; nop; - goto -> bb4; + goto -> bb3; } - bb4: { + bb3: { return; } - bb5 (cleanup): { + bb4 (cleanup): { resume; } - bb6 (cleanup): { + bb5 (cleanup): { nop; - goto -> bb7; - } - - bb7 (cleanup): { StorageDead(_6); StorageDead(_5); nop; nop; - goto -> bb5; + goto -> bb4; } - bb8: { + bb6: { return; } - bb9: { - goto -> bb8; + bb7: { + goto -> bb6; } - bb10: { + bb8: { StorageLive(_5); StorageLive(_6); StorageLive(_22); @@ -141,7 +133,7 @@ fn includes_never::{closure#0}(_1: &mut {async fn body of includes_never()}) -> goto -> bb1; } - bb11: { + bb9: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.StateTransform.diff index 11939da81cad4..2cbab5dd1c2b7 100644 --- a/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.StateTransform.diff @@ -76,12 +76,12 @@ - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); -- _6 = String::new() -> [return: bb1, unwind: bb30]; +- _6 = String::new() -> [return: bb1, unwind: bb27]; + _30 = move _2 as std::ptr::NonNull> (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: bb31, 1: bb30, 2: bb29, 3: bb28, otherwise: bb7]; ++ switchInt(move _27) -> [0: bb29, 1: bb28, 2: bb27, 3: bb26, otherwise: bb7]; } bb1: { @@ -92,8 +92,8 @@ + _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]; +- _8 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as IntoFuture>::into_future(move _9) -> [return: bb2, unwind: bb24]; ++ _8 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as IntoFuture>::into_future(move _9) -> [return: bb2, unwind: bb19]; } bb2: { @@ -115,8 +115,8 @@ - _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]; +- _15 = Pin::<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>::new_unchecked(move _16) -> [return: bb4, unwind: bb20]; ++ _15 = Pin::<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>::new_unchecked(move _16) -> [return: bb4, unwind: bb15]; } bb4: { @@ -125,7 +125,7 @@ StorageLive(_19); StorageLive(_20); - _20 = copy _2; -- _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb5, unwind: bb20]; +- _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb5, unwind: bb18]; + _20 = copy _29; + _19 = copy (_20.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb5; @@ -134,8 +134,8 @@ 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]; +- _14 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as Future>::poll(move _15, move _18) -> [return: bb6, unwind: bb19]; ++ _14 = <{async block@$DIR/async_fn.rs:80:50: 80:55} as Future>::poll(move _15, move _18) -> [return: bb6, unwind: bb14]; } bb6: { @@ -159,7 +159,7 @@ StorageLive(_24); StorageLive(_25); _25 = (); -- _24 = yield(move _25) -> [resume: bb10, drop: bb15]; +- _24 = yield(move _25) -> [resume: bb10, drop: bb14]; + _0 = Poll::::Pending; + StorageDead(_4); + StorageDead(_5); @@ -178,8 +178,8 @@ 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]; +- drop(_11) -> [return: bb11, unwind: bb22]; ++ drop((((*_28) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55})) -> [return: bb11, unwind: bb17]; } bb10: { @@ -193,140 +193,133 @@ bb11: { - StorageDead(_11); -- drop(_6) -> [return: bb12, unwind: bb25]; +- drop(_6) -> [return: bb12, unwind: bb23]; + nop; -+ drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb12, unwind: bb19]; ++ drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb12, unwind: bb18]; } bb12: { - StorageDead(_6); + nop; - goto -> bb13; - } - - bb13: { StorageDead(_8); StorageDead(_5); StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb14, unwind: bb32]; +- drop(_1) -> [return: bb13, unwind: bb29]; + nop; -+ goto -> bb14; ++ goto -> bb13; } - bb14: { + bb13: { + _0 = Poll::::Ready(move _26); + discriminant((*_28)) = 1; return; } -- bb15: { +- bb14: { - StorageDead(_25); - StorageDead(_24); -- drop(_11) -> [return: bb16, unwind: bb33]; -+ bb15 (cleanup): { +- drop(_11) -> [return: bb15, unwind: bb30]; ++ bb14 (cleanup): { + StorageDead(_19); + StorageDead(_18); -+ goto -> bb17; ++ goto -> bb16; } -- bb16: { +- bb15: { - StorageDead(_11); -- drop(_6) -> [return: bb17, unwind: bb34]; -+ bb16 (cleanup): { +- drop(_6) -> [return: bb16, unwind: bb31]; ++ bb15 (cleanup): { + StorageDead(_16); -+ goto -> bb17; ++ goto -> bb16; } -- bb17: { +- bb16: { - 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)]; +- drop(_1) -> [return: bb17, unwind: bb29]; ++ bb16 (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: bb17, unwind terminate(cleanup)]; } -- bb19: { +- bb17: { - coroutine_drop; -+ bb19 (cleanup): { ++ bb17 (cleanup): { + nop; -+ goto -> bb23; ++ drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb18, unwind terminate(cleanup)]; } - bb20 (cleanup): { + bb18 (cleanup): { - StorageDead(_20); - goto -> bb21; +- goto -> bb19; ++ nop; ++ goto -> bb21; } - bb21 (cleanup): { + bb19 (cleanup): { - StorageDead(_19); - StorageDead(_18); -- goto -> bb23; +- goto -> bb21; + StorageDead(_9); -+ drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb22, unwind terminate(cleanup)]; ++ drop((((*_28) as variant#3).1: std::string::String)) -> [return: bb20, unwind terminate(cleanup)]; } - bb22 (cleanup): { + bb20 (cleanup): { - StorageDead(_16); + nop; - goto -> bb23; + goto -> bb21; } - bb23 (cleanup): { + bb21 (cleanup): { - StorageDead(_17); - StorageDead(_15); - StorageDead(_14); - StorageDead(_13); -- drop(_11) -> [return: bb24, unwind terminate(cleanup)]; +- drop(_11) -> [return: bb22, unwind terminate(cleanup)]; + StorageDead(_8); -+ goto -> bb25; ++ goto -> bb23; } - bb24 (cleanup): { + bb22 (cleanup): { - StorageDead(_11); -- drop(_6) -> [return: bb25, unwind terminate(cleanup)]; +- drop(_6) -> [return: bb23, unwind terminate(cleanup)]; + nop; -+ goto -> bb25; ++ goto -> bb23; } - bb25 (cleanup): { + bb23 (cleanup): { - StorageDead(_6); -- goto -> bb29; +- goto -> bb26; + StorageDead(_5); + StorageDead(_4); + nop; -+ goto -> bb26; ++ goto -> bb24; } - bb26 (cleanup): { - goto -> bb27; + bb24 (cleanup): { +- StorageDead(_9); +- drop(_6) -> [return: bb25, unwind terminate(cleanup)]; ++ goto -> bb25; } - bb27 (cleanup): { -- StorageDead(_9); -- drop(_6) -> [return: bb28, unwind terminate(cleanup)]; + bb25 (cleanup): { +- StorageDead(_6); +- goto -> bb26; + discriminant((*_28)) = 2; + resume; } -- bb28 (cleanup): { -- StorageDead(_6); -- goto -> bb29; -+ bb28: { +- bb26 (cleanup): { +- StorageDead(_8); +- goto -> bb28; ++ bb26: { + StorageLive(_4); + StorageLive(_5); + StorageLive(_8); @@ -336,54 +329,45 @@ + goto -> bb10; } -- bb29 (cleanup): { -- StorageDead(_8); -- goto -> bb31; -+ bb29: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb29, unwind continue]; - } - -- bb30 (cleanup): { +- bb27 (cleanup): { - StorageDead(_6); -- goto -> bb31; -+ bb30: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb30, unwind continue]; +- goto -> bb28; ++ bb27: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb27, unwind continue]; } -- bb31 (cleanup): { +- bb28 (cleanup): { - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb32, unwind terminate(cleanup)]; -- } -- -- bb32 (cleanup): { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb28: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind continue]; + } + +- bb29 (cleanup): { - resume; - } - -- bb33 (cleanup): { +- bb30 (cleanup): { - StorageDead(_11); -- drop(_6) -> [return: bb34, unwind terminate(cleanup)]; +- drop(_6) -> [return: bb31, unwind terminate(cleanup)]; - } - -- bb34 (cleanup): { +- bb31 (cleanup): { - StorageDead(_6); -- goto -> bb35; -- } -- -- bb35 (cleanup): { - StorageDead(_8); - StorageDead(_5); - StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb32, unwind terminate(cleanup)]; -+ bb31: { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb29: { + 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]; ++ (((*_28) as variant#3).1: std::string::String) = String::new() -> [return: bb1, unwind: bb22]; } } diff --git a/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.coroutine_drop.0.mir index c76b3ca617f76..14418fd1bc390 100644 --- a/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.partial_init-{closure#0}.coroutine_drop.0.mir @@ -47,68 +47,60 @@ fn partial_init::{closure#0}(_1: &mut {async fn body of partial_init()}) -> () { bb0: { _27 = discriminant((*_1)); - switchInt(move _27) -> [0: bb11, 3: bb12, otherwise: bb13]; + switchInt(move _27) -> [0: bb9, 3: bb10, otherwise: bb11]; } bb1: { StorageDead(_25); StorageDead(_24); - drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55})) -> [return: bb2, unwind: bb7]; + drop((((*_1) as variant#3).2: {async block@$DIR/async_fn.rs:80:50: 80:55})) -> [return: bb2, unwind: bb6]; } bb2: { nop; - drop((((*_1) as variant#3).1: std::string::String)) -> [return: bb3, unwind: bb8]; + drop((((*_1) as variant#3).1: std::string::String)) -> [return: bb3, unwind: bb7]; } bb3: { nop; - goto -> bb4; - } - - bb4: { StorageDead(_8); StorageDead(_5); StorageDead(_4); nop; - goto -> bb5; + goto -> bb4; } - bb5: { + bb4: { return; } - bb6 (cleanup): { + bb5 (cleanup): { resume; } - bb7 (cleanup): { + bb6 (cleanup): { nop; - drop((((*_1) as variant#3).1: std::string::String)) -> [return: bb8, unwind terminate(cleanup)]; + drop((((*_1) as variant#3).1: std::string::String)) -> [return: bb7, unwind terminate(cleanup)]; } - bb8 (cleanup): { + bb7 (cleanup): { nop; - goto -> bb9; - } - - bb9 (cleanup): { StorageDead(_8); StorageDead(_5); StorageDead(_4); nop; - goto -> bb6; + goto -> bb5; } - bb10: { + bb8: { return; } - bb11: { - goto -> bb10; + bb9: { + goto -> bb8; } - bb12: { + bb10: { StorageLive(_4); StorageLive(_5); StorageLive(_8); @@ -117,7 +109,7 @@ fn partial_init::{closure#0}(_1: &mut {async fn body of partial_init()}) -> () { goto -> bb1; } - bb13: { + bb11: { return; } } diff --git a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.StateTransform.diff index 6e9edd2faebcd..671076e5aac92 100644 --- a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.StateTransform.diff @@ -108,7 +108,7 @@ + _47 = std::future::ResumeTy(move _48); + _46 = copy (_1.0: &mut {async fn body of uninhabited_variant()}); + _45 = discriminant((*_46)); -+ switchInt(move _45) -> [0: bb55, 1: bb54, 2: bb53, 3: bb51, 4: bb52, otherwise: bb1]; ++ switchInt(move _45) -> [0: bb51, 1: bb50, 2: bb49, 3: bb47, 4: bb48, otherwise: bb1]; } bb1: { @@ -123,8 +123,8 @@ StorageLive(_27); StorageLive(_28); _28 = move _24; -- _27 = uninhabited_variant::{closure#0}::unreachable(move _28) -> [return: bb14, unwind: bb43]; -+ _27 = uninhabited_variant::{closure#0}::unreachable(move _28) -> [return: bb14, unwind: bb33]; +- _27 = uninhabited_variant::{closure#0}::unreachable(move _28) -> [return: bb13, unwind: bb38]; ++ _27 = uninhabited_variant::{closure#0}::unreachable(move _28) -> [return: bb13, unwind: bb30]; } bb3: { @@ -133,10 +133,10 @@ StorageLive(_8); - _43 = const false; - _8 = move _3; -- _7 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as IntoFuture>::into_future(move _8) -> [return: bb4, unwind: bb51]; +- _7 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as IntoFuture>::into_future(move _8) -> [return: bb4, unwind: bb46]; + (((*_46) as variant#4).2: bool) = const false; + _8 = move (((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18}); -+ _7 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as IntoFuture>::into_future(move _8) -> [return: bb4, unwind: bb40]; ++ _7 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as IntoFuture>::into_future(move _8) -> [return: bb4, unwind: bb37]; } bb4: { @@ -158,8 +158,8 @@ - _15 = &mut _9; + _15 = &mut (((*_46) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18}); _14 = &mut (*_15); -- _13 = Pin::<&mut {async block@$DIR/async_fn.rs:106:13: 106:18}>::new_unchecked(move _14) -> [return: bb6, unwind: bb48]; -+ _13 = Pin::<&mut {async block@$DIR/async_fn.rs:106:13: 106:18}>::new_unchecked(move _14) -> [return: bb6, unwind: bb37]; +- _13 = Pin::<&mut {async block@$DIR/async_fn.rs:106:13: 106:18}>::new_unchecked(move _14) -> [return: bb6, unwind: bb43]; ++ _13 = Pin::<&mut {async block@$DIR/async_fn.rs:106:13: 106:18}>::new_unchecked(move _14) -> [return: bb6, unwind: bb34]; } bb6: { @@ -168,7 +168,7 @@ StorageLive(_17); StorageLive(_18); - _18 = copy _2; -- _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb7, unwind: bb46]; +- _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb7, unwind: bb41]; + _18 = copy _47; + _17 = copy (_18.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); + goto -> bb7; @@ -177,8 +177,8 @@ bb7: { _16 = &mut (*_17); StorageDead(_18); -- _12 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as Future>::poll(move _13, move _16) -> [return: bb8, unwind: bb47]; -+ _12 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as Future>::poll(move _13, move _16) -> [return: bb8, unwind: bb36]; +- _12 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as Future>::poll(move _13, move _16) -> [return: bb8, unwind: bb42]; ++ _12 = <{async block@$DIR/async_fn.rs:106:13: 106:18} as Future>::poll(move _13, move _16) -> [return: bb8, unwind: bb33]; } bb8: { @@ -198,7 +198,7 @@ StorageLive(_22); StorageLive(_23); _23 = (); -- _22 = yield(move _23) -> [resume: bb11, drop: bb31]; +- _22 = yield(move _23) -> [resume: bb11, drop: bb28]; + _0 = Poll::<()>::Pending; + StorageDead(_4); + StorageDead(_6); @@ -216,8 +216,8 @@ StorageDead(_20); StorageDead(_12); StorageDead(_11); -- drop(_9) -> [return: bb12, unwind: bb50]; -+ drop((((*_46) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb12, unwind: bb39]; +- drop(_9) -> [return: bb12, unwind: bb45]; ++ drop((((*_46) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb12, unwind: bb36]; } bb11: { @@ -232,34 +232,30 @@ bb12: { - StorageDead(_9); + nop; - goto -> bb13; - } - - bb13: { StorageDead(_7); StorageDead(_6); - _0 = const (); + _44 = const (); - goto -> bb25; + goto -> bb23; } - bb14: { + bb13: { StorageDead(_28); -- _26 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as IntoFuture>::into_future(move _27) -> [return: bb15, unwind: bb42]; -+ _26 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as IntoFuture>::into_future(move _27) -> [return: bb15, unwind: bb32]; +- _26 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as IntoFuture>::into_future(move _27) -> [return: bb14, unwind: bb39]; ++ _26 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as IntoFuture>::into_future(move _27) -> [return: bb14, unwind: bb31]; } - bb15: { + bb14: { StorageDead(_27); PlaceMention(_26); - StorageLive(_29); - _29 = move _26; + nop; + (((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()}) = move _26; - goto -> bb16; + goto -> bb15; } - bb16: { + bb15: { StorageLive(_30); StorageLive(_31); StorageLive(_32); @@ -268,47 +264,47 @@ - _34 = &mut _29; + _34 = &mut (((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()}); _33 = &mut (*_34); -- _32 = Pin::<&mut {async fn body of uninhabited_variant::{closure#0}::unreachable()}>::new_unchecked(move _33) -> [return: bb17, unwind: bb39]; -+ _32 = Pin::<&mut {async fn body of uninhabited_variant::{closure#0}::unreachable()}>::new_unchecked(move _33) -> [return: bb17, unwind: bb29]; +- _32 = Pin::<&mut {async fn body of uninhabited_variant::{closure#0}::unreachable()}>::new_unchecked(move _33) -> [return: bb16, unwind: bb35]; ++ _32 = Pin::<&mut {async fn body of uninhabited_variant::{closure#0}::unreachable()}>::new_unchecked(move _33) -> [return: bb16, unwind: bb27]; } - bb17: { + bb16: { StorageDead(_33); StorageLive(_35); StorageLive(_36); StorageLive(_37); - _37 = copy _2; -- _36 = std::future::get_context::<'_, '_>(move _37) -> [return: bb18, unwind: bb37]; +- _36 = std::future::get_context::<'_, '_>(move _37) -> [return: bb17, unwind: bb33]; + _37 = copy _47; + _36 = copy (_37.0: std::ptr::NonNull>) as &mut std::task::Context<'_> (Transmute); -+ goto -> bb18; ++ goto -> bb17; } - bb18: { + bb17: { _35 = &mut (*_36); StorageDead(_37); -- _31 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as Future>::poll(move _32, move _35) -> [return: bb19, unwind: bb38]; -+ _31 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as Future>::poll(move _32, move _35) -> [return: bb19, unwind: bb28]; +- _31 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as Future>::poll(move _32, move _35) -> [return: bb18, unwind: bb34]; ++ _31 = <{async fn body of uninhabited_variant::{closure#0}::unreachable()} as Future>::poll(move _32, move _35) -> [return: bb18, unwind: bb26]; } - bb19: { + bb18: { StorageDead(_36); StorageDead(_35); StorageDead(_34); StorageDead(_32); PlaceMention(_31); _38 = discriminant(_31); - switchInt(move _38) -> [0: bb21, 1: bb20, otherwise: bb1]; + switchInt(move _38) -> [0: bb20, 1: bb19, otherwise: bb1]; } - bb20: { + bb19: { _30 = const (); StorageDead(_31); StorageDead(_30); StorageLive(_41); StorageLive(_42); _42 = (); -- _41 = yield(move _42) -> [resume: bb22, drop: bb28]; +- _41 = yield(move _42) -> [resume: bb21, drop: bb26]; + _0 = Poll::<()>::Pending; + StorageDead(_4); + StorageDead(_24); @@ -320,305 +316,281 @@ + return; } - bb21: { + bb20: { StorageLive(_39); _39 = copy ((_31 as Ready).0: ()); _25 = copy _39; StorageDead(_39); StorageDead(_31); StorageDead(_30); -- drop(_29) -> [return: bb23, unwind: bb41]; -+ drop((((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb23, unwind: bb31]; +- drop(_29) -> [return: bb22, unwind: bb37]; ++ drop((((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb22, unwind: bb29]; } - bb22: { + bb21: { StorageDead(_42); - _2 = move _41; + _47 = move _41; StorageDead(_41); _10 = const (); - goto -> bb16; + goto -> bb15; } - bb23: { + bb22: { - StorageDead(_29); + nop; - goto -> bb24; - } - - bb24: { StorageDead(_26); StorageDead(_25); - _0 = const (); + _44 = const (); StorageDead(_24); - goto -> bb25; + goto -> bb23; } - bb25: { + bb23: { StorageDead(_4); -- goto -> bb64; -+ goto -> bb47; +- goto -> bb56; ++ goto -> bb43; } - bb26: { + bb24: { - _43 = const false; - StorageDead(_3); -- drop(_1) -> [return: bb27, unwind: bb56]; +- drop(_1) -> [return: bb25, unwind: bb50]; + (((*_46) as variant#4).2: bool) = const false; + nop; -+ goto -> bb27; ++ goto -> bb25; } - bb27: { + bb25: { + _0 = Poll::<()>::Ready(move _44); + discriminant((*_46)) = 1; return; } -- bb28: { +- bb26: { - StorageDead(_42); - StorageDead(_41); -- drop(_29) -> [return: bb29, unwind: bb57]; +- drop(_29) -> [return: bb27, unwind: bb51]; - } - -- bb29: { +- bb27: { - StorageDead(_29); -- goto -> bb30; -- } -- -- bb30: { - StorageDead(_26); - StorageDead(_25); - StorageDead(_24); -- goto -> bb34; +- goto -> bb30; - } - -- bb31: { +- bb28: { - StorageDead(_23); - StorageDead(_22); -- drop(_9) -> [return: bb32, unwind: bb59]; +- drop(_9) -> [return: bb29, unwind: bb52]; - } - -- bb32: { +- bb29: { - StorageDead(_9); -- goto -> bb33; -- } -- -- bb33: { - StorageDead(_7); - StorageDead(_6); -- goto -> bb34; +- goto -> bb30; - } - -- bb34: { +- bb30: { - StorageDead(_4); -- goto -> bb66; +- goto -> bb58; - } - -- bb35: { +- bb31: { - _43 = const false; - StorageDead(_3); -- drop(_1) -> [return: bb36, unwind: bb56]; +- drop(_1) -> [return: bb32, unwind: bb50]; - } - -- bb36: { +- bb32: { - coroutine_drop; - } - -- bb37 (cleanup): { +- bb33 (cleanup): { - StorageDead(_37); -- goto -> bb38; +- goto -> bb34; - } - -- bb38 (cleanup): { -+ bb28 (cleanup): { +- bb34 (cleanup): { ++ bb26 (cleanup): { StorageDead(_36); StorageDead(_35); -- goto -> bb40; -+ goto -> bb30; +- goto -> bb36; ++ goto -> bb28; } -- bb39 (cleanup): { -+ bb29 (cleanup): { +- bb35 (cleanup): { ++ bb27 (cleanup): { StorageDead(_33); -- goto -> bb40; -+ goto -> bb30; +- goto -> bb36; ++ goto -> bb28; } -- bb40 (cleanup): { -+ bb30 (cleanup): { +- bb36 (cleanup): { ++ bb28 (cleanup): { StorageDead(_34); StorageDead(_32); StorageDead(_31); StorageDead(_30); -- drop(_29) -> [return: bb41, unwind terminate(cleanup)]; -+ drop((((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb31, unwind terminate(cleanup)]; +- drop(_29) -> [return: bb37, unwind terminate(cleanup)]; ++ drop((((*_46) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb29, unwind terminate(cleanup)]; } -- bb41 (cleanup): { +- bb37 (cleanup): { - StorageDead(_29); -- goto -> bb45; -+ bb31 (cleanup): { +- goto -> bb40; ++ bb29 (cleanup): { + nop; -+ goto -> bb35; - } - -- bb42 (cleanup): { -- goto -> bb44; -+ bb32 (cleanup): { -+ goto -> bb34; ++ goto -> bb32; } -- bb43 (cleanup): { -+ bb33 (cleanup): { +- bb38 (cleanup): { ++ bb30 (cleanup): { StorageDead(_28); -- goto -> bb44; -+ goto -> bb34; +- goto -> bb39; ++ goto -> bb31; } -- bb44 (cleanup): { -+ bb34 (cleanup): { +- bb39 (cleanup): { ++ bb31 (cleanup): { StorageDead(_27); -- goto -> bb45; -+ goto -> bb35; +- goto -> bb40; ++ goto -> bb32; } -- bb45 (cleanup): { -+ bb35 (cleanup): { +- bb40 (cleanup): { ++ bb32 (cleanup): { StorageDead(_26); StorageDead(_25); StorageDead(_24); -- goto -> bb54; -+ goto -> bb43; +- goto -> bb48; ++ goto -> bb39; } -- bb46 (cleanup): { +- bb41 (cleanup): { - StorageDead(_18); -- goto -> bb47; +- goto -> bb42; - } - -- bb47 (cleanup): { -+ bb36 (cleanup): { +- bb42 (cleanup): { ++ bb33 (cleanup): { StorageDead(_17); StorageDead(_16); -- goto -> bb49; -+ goto -> bb38; +- goto -> bb44; ++ goto -> bb35; } -- bb48 (cleanup): { -+ bb37 (cleanup): { +- bb43 (cleanup): { ++ bb34 (cleanup): { StorageDead(_14); -- goto -> bb49; -+ goto -> bb38; +- goto -> bb44; ++ goto -> bb35; } -- bb49 (cleanup): { -+ bb38 (cleanup): { +- bb44 (cleanup): { ++ bb35 (cleanup): { StorageDead(_15); StorageDead(_13); StorageDead(_12); StorageDead(_11); -- drop(_9) -> [return: bb50, unwind terminate(cleanup)]; -+ drop((((*_46) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb39, unwind terminate(cleanup)]; +- drop(_9) -> [return: bb45, unwind terminate(cleanup)]; ++ drop((((*_46) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb36, unwind terminate(cleanup)]; } -- bb50 (cleanup): { +- bb45 (cleanup): { - StorageDead(_9); -- goto -> bb53; -+ bb39 (cleanup): { +- goto -> bb47; ++ bb36 (cleanup): { + nop; -+ goto -> bb42; - } - -- bb51 (cleanup): { -- goto -> bb52; -+ bb40 (cleanup): { -+ goto -> bb41; ++ goto -> bb38; } -- bb52 (cleanup): { -+ bb41 (cleanup): { +- bb46 (cleanup): { ++ bb37 (cleanup): { StorageDead(_8); -- goto -> bb53; -+ goto -> bb42; +- goto -> bb47; ++ goto -> bb38; } -- bb53 (cleanup): { -+ bb42 (cleanup): { +- bb47 (cleanup): { ++ bb38 (cleanup): { StorageDead(_7); StorageDead(_6); -- goto -> bb54; -+ goto -> bb43; +- goto -> bb48; ++ goto -> bb39; } -- bb54 (cleanup): { -+ bb43 (cleanup): { +- bb48 (cleanup): { ++ bb39 (cleanup): { StorageDead(_4); -- goto -> bb68; -+ goto -> bb49; +- goto -> bb60; ++ goto -> bb45; } -- bb55 (cleanup): { +- bb49 (cleanup): { - _43 = const false; - StorageDead(_3); -- drop(_1) -> [return: bb56, unwind terminate(cleanup)]; -+ bb44 (cleanup): { +- drop(_1) -> [return: bb50, unwind terminate(cleanup)]; ++ bb40 (cleanup): { + (((*_46) as variant#4).2: bool) = const false; + nop; -+ goto -> bb45; ++ goto -> bb41; } -- bb56 (cleanup): { +- bb50 (cleanup): { - resume; -+ bb45 (cleanup): { -+ goto -> bb50; ++ bb41 (cleanup): { ++ goto -> bb46; } -- bb57 (cleanup): { +- bb51 (cleanup): { - StorageDead(_29); -- goto -> bb58; -+ bb46: { -+ drop((((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb26, unwind: bb44]; - } - -- bb58 (cleanup): { - StorageDead(_26); - StorageDead(_25); - StorageDead(_24); -- goto -> bb61; -+ bb47: { -+ switchInt(copy (((*_46) as variant#4).2: bool)) -> [0: bb26, otherwise: bb46]; +- goto -> bb53; ++ bb42: { ++ drop((((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb24, unwind: bb40]; } -- bb59 (cleanup): { +- bb52 (cleanup): { - StorageDead(_9); -- goto -> bb60; -+ bb48 (cleanup): { -+ drop((((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb44, unwind terminate(cleanup)]; - } - -- bb60 (cleanup): { - StorageDead(_7); - StorageDead(_6); -- goto -> bb61; -+ bb49 (cleanup): { -+ switchInt(copy (((*_46) as variant#4).2: bool)) -> [0: bb44, otherwise: bb48]; +- goto -> bb53; ++ bb43: { ++ switchInt(copy (((*_46) as variant#4).2: bool)) -> [0: bb24, otherwise: bb42]; } -- bb61 (cleanup): { +- bb53 (cleanup): { - StorageDead(_4); -- goto -> bb70; -+ bb50 (cleanup): { -+ discriminant((*_46)) = 2; -+ resume; +- goto -> bb62; ++ bb44 (cleanup): { ++ drop((((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb40, unwind terminate(cleanup)]; } -- bb62 (cleanup): { +- bb54 (cleanup): { - _43 = const false; - StorageDead(_3); -- drop(_1) -> [return: bb56, unwind terminate(cleanup)]; -+ bb51: { +- drop(_1) -> [return: bb50, unwind terminate(cleanup)]; ++ bb45 (cleanup): { ++ switchInt(copy (((*_46) as variant#4).2: bool)) -> [0: bb40, otherwise: bb44]; + } + +- bb55: { +- drop(_3) -> [return: bb24, unwind: bb49]; ++ bb46 (cleanup): { ++ discriminant((*_46)) = 2; ++ resume; + } + +- bb56: { +- switchInt(copy _43) -> [0: bb24, otherwise: bb55]; ++ bb47: { + StorageLive(_4); + StorageLive(_6); + StorageLive(_7); @@ -628,9 +600,9 @@ + goto -> bb11; } -- bb63: { -- drop(_3) -> [return: bb26, unwind: bb55]; -+ bb52: { +- bb57: { +- drop(_3) -> [return: bb31, unwind: bb54]; ++ bb48: { + StorageLive(_4); + StorageLive(_24); + StorageLive(_25); @@ -638,40 +610,32 @@ + StorageLive(_41); + StorageLive(_42); + _41 = move _47; -+ goto -> bb22; ++ goto -> bb21; } -- bb64: { -- switchInt(copy _43) -> [0: bb26, otherwise: bb63]; -+ bb53: { -+ assert(const false, "`async fn` resumed after panicking") -> [success: bb53, unwind continue]; +- bb58: { +- switchInt(copy _43) -> [0: bb31, otherwise: bb57]; ++ bb49: { ++ assert(const false, "`async fn` resumed after panicking") -> [success: bb49, unwind continue]; } -- bb65: { -- drop(_3) -> [return: bb35, unwind: bb62]; -+ bb54: { -+ assert(const false, "`async fn` resumed after completion") -> [success: bb54, unwind continue]; +- bb59 (cleanup): { +- drop(_3) -> [return: bb49, unwind terminate(cleanup)]; ++ bb50: { ++ assert(const false, "`async fn` resumed after completion") -> [success: bb50, unwind continue]; } -- bb66: { -- switchInt(copy _43) -> [0: bb35, otherwise: bb65]; -- } -- -- bb67 (cleanup): { -- drop(_3) -> [return: bb55, unwind terminate(cleanup)]; -- } -- -- bb68 (cleanup): { -- switchInt(copy _43) -> [0: bb55, otherwise: bb67]; +- bb60 (cleanup): { +- switchInt(copy _43) -> [0: bb49, otherwise: bb59]; - } - -- bb69 (cleanup): { -- drop(_3) -> [return: bb62, unwind terminate(cleanup)]; +- bb61 (cleanup): { +- drop(_3) -> [return: bb54, unwind terminate(cleanup)]; - } - -- bb70 (cleanup): { -- switchInt(copy _43) -> [0: bb62, otherwise: bb69]; -+ bb55: { +- bb62 (cleanup): { +- switchInt(copy _43) -> [0: bb54, otherwise: bb61]; ++ bb51: { + (((*_46) as variant#4).2: bool) = const false; + nop; + (((*_46) as variant#4).2: bool) = const true; diff --git a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.coroutine_drop.0.mir b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.coroutine_drop.0.mir index 19cde28ce35fb..5ba2a94674ce7 100644 --- a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.coroutine_drop.0.mir +++ b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-{closure#0}.coroutine_drop.0.mir @@ -68,131 +68,115 @@ fn uninhabited_variant::{closure#0}(_1: &mut {async fn body of uninhabited_varia bb0: { _45 = discriminant((*_1)); - switchInt(move _45) -> [0: bb22, 3: bb23, 4: bb24, otherwise: bb25]; + switchInt(move _45) -> [0: bb18, 3: bb19, 4: bb20, otherwise: bb21]; } bb1: { StorageDead(_42); StorageDead(_41); - drop((((*_1) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb2, unwind: bb11]; + drop((((*_1) as variant#4).1: {async fn body of uninhabited_variant::{closure#0}::unreachable()})) -> [return: bb2, unwind: bb9]; } bb2: { nop; - goto -> bb3; - } - - bb3: { StorageDead(_26); StorageDead(_25); StorageDead(_24); - goto -> bb7; + goto -> bb5; } - bb4: { + bb3: { StorageDead(_23); StorageDead(_22); - drop((((*_1) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb5, unwind: bb13]; + drop((((*_1) as variant#3).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb4, unwind: bb10]; } - bb5: { + bb4: { nop; - goto -> bb6; - } - - bb6: { StorageDead(_7); StorageDead(_6); - goto -> bb7; + goto -> bb5; } - bb7: { + bb5: { StorageDead(_4); - goto -> bb18; + goto -> bb14; } - bb8: { + bb6: { (((*_1) as variant#4).2: bool) = const false; nop; - goto -> bb9; + goto -> bb7; } - bb9: { + bb7: { return; } - bb10 (cleanup): { + bb8 (cleanup): { resume; } - bb11 (cleanup): { + bb9 (cleanup): { nop; - goto -> bb12; - } - - bb12 (cleanup): { StorageDead(_26); StorageDead(_25); StorageDead(_24); - goto -> bb15; + goto -> bb11; } - bb13 (cleanup): { + bb10 (cleanup): { nop; - goto -> bb14; - } - - bb14 (cleanup): { StorageDead(_7); StorageDead(_6); - goto -> bb15; + goto -> bb11; } - bb15 (cleanup): { + bb11 (cleanup): { StorageDead(_4); - goto -> bb20; + goto -> bb16; } - bb16 (cleanup): { + bb12 (cleanup): { (((*_1) as variant#4).2: bool) = const false; nop; - goto -> bb10; + goto -> bb8; } - bb17: { - drop((((*_1) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb8, unwind: bb16]; + bb13: { + drop((((*_1) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb6, unwind: bb12]; } - bb18: { - switchInt(copy (((*_1) as variant#4).2: bool)) -> [0: bb8, otherwise: bb17]; + bb14: { + switchInt(copy (((*_1) as variant#4).2: bool)) -> [0: bb6, otherwise: bb13]; } - bb19 (cleanup): { - drop((((*_1) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb16, unwind terminate(cleanup)]; + bb15 (cleanup): { + drop((((*_1) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18})) -> [return: bb12, unwind terminate(cleanup)]; } - bb20 (cleanup): { - switchInt(copy (((*_1) as variant#4).2: bool)) -> [0: bb16, otherwise: bb19]; + bb16 (cleanup): { + switchInt(copy (((*_1) as variant#4).2: bool)) -> [0: bb12, otherwise: bb15]; } - bb21: { + bb17: { return; } - bb22: { - goto -> bb21; + bb18: { + goto -> bb17; } - bb23: { + bb19: { StorageLive(_4); StorageLive(_6); StorageLive(_7); StorageLive(_22); StorageLive(_23); - goto -> bb4; + goto -> bb3; } - bb24: { + bb20: { StorageLive(_4); StorageLive(_24); StorageLive(_25); @@ -202,7 +186,7 @@ fn uninhabited_variant::{closure#0}(_1: &mut {async fn body of uninhabited_varia goto -> bb1; } - bb25: { + bb21: { return; } } diff --git a/tests/mir-opt/coroutine/coroutine.main-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/coroutine.main-{closure#0}.StateTransform.diff index d9d65147e1e83..53624b4b71f66 100644 --- a/tests/mir-opt/coroutine/coroutine.main-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/coroutine.main-{closure#0}.StateTransform.diff @@ -44,28 +44,24 @@ - StorageLive(_5); - StorageLive(_6); - _6 = &_2; -- _5 = ::clone(move _6) -> [return: bb1, unwind: bb31]; +- _5 = ::clone(move _6) -> [return: bb1, unwind: bb24]; + _18 = copy (_1.0: &mut {coroutine@$DIR/coroutine.rs:19:5: 19:18}); + _17 = discriminant((*_18)); -+ switchInt(move _17) -> [0: bb35, 1: bb33, 2: bb32, 3: bb30, 4: bb31, otherwise: bb34]; ++ switchInt(move _17) -> [0: bb29, 1: bb27, 2: bb26, 3: bb24, 4: bb25, otherwise: bb28]; } bb1: { StorageDead(_6); StorageLive(_7); -- _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb30]; -+ _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb21]; +- _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb23]; ++ _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb16]; } bb2: { _4 = (const "first", move _5, move _7); StorageDead(_7); - goto -> bb3; - } - - bb3: { StorageDead(_5); -- _3 = yield(move _4) -> [resume: bb4, drop: bb18]; +- _3 = yield(move _4) -> [resume: bb3, drop: bb13]; + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Yielded(move _4); + StorageDead(_3); + StorageDead(_4); @@ -73,17 +69,13 @@ + return; } - bb4: { - goto -> bb5; - } - - bb5: { + bb3: { StorageDead(_4); -- drop(_3) -> [return: bb6, unwind: bb34]; -+ drop(_3) -> [return: bb6, unwind: bb25]; +- drop(_3) -> [return: bb4, unwind: bb26]; ++ drop(_3) -> [return: bb4, unwind: bb19]; } - bb6: { + bb4: { StorageDead(_3); StorageLive(_8); StorageLive(_9); @@ -94,30 +86,26 @@ StorageLive(_12); StorageLive(_13); - _13 = &_2; -- _12 = ::clone(move _13) -> [return: bb7, unwind: bb28]; +- _12 = ::clone(move _13) -> [return: bb5, unwind: bb21]; + _13 = &(((*_18) as variant#4).0: std::string::String); -+ _12 = ::clone(move _13) -> [return: bb7, unwind: bb19]; ++ _12 = ::clone(move _13) -> [return: bb5, unwind: bb14]; } - bb7: { + bb5: { StorageDead(_13); StorageLive(_14); StorageLive(_15); -- _15 = Location::<'_>::caller() -> [return: bb8, unwind: bb24]; -+ _15 = Location::<'_>::caller() -> [return: bb8, unwind: bb15]; +- _15 = Location::<'_>::caller() -> [return: bb6, unwind: bb18]; ++ _15 = Location::<'_>::caller() -> [return: bb6, unwind: bb11]; } - bb8: { + bb6: { _14 = &(*_15); _9 = (move _10, move _12, move _14); StorageDead(_14); - goto -> bb9; - } - - bb9: { StorageDead(_12); StorageDead(_10); -- _8 = yield(move _9) -> [resume: bb10, drop: bb15]; +- _8 = yield(move _9) -> [resume: bb7, drop: bb11]; + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Yielded(move _9); + StorageDead(_8); + StorageDead(_9); @@ -127,216 +115,192 @@ + return; } - bb10: { - goto -> bb11; - } - - bb11: { + bb7: { StorageDead(_9); -- drop(_8) -> [return: bb12, unwind: bb27]; -+ drop(_8) -> [return: bb12, unwind: bb18]; +- drop(_8) -> [return: bb8, unwind: bb20]; ++ drop(_8) -> [return: bb8, unwind: bb13]; } - bb12: { + bb8: { StorageDead(_15); StorageDead(_11); StorageDead(_8); - _0 = const (); -- drop(_2) -> [return: bb13, unwind: bb36]; +- drop(_2) -> [return: bb9, unwind: bb28]; + _16 = const (); -+ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb13, unwind: bb27]; ++ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb9, unwind: bb21]; } - bb13: { -- drop(_1) -> [return: bb14, unwind: bb37]; -+ goto -> bb14; + bb9: { +- drop(_1) -> [return: bb10, unwind: bb29]; ++ goto -> bb10; } - bb14: { + bb10: { + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Complete(move _16); + discriminant((*_18)) = 1; return; } -- bb15: { -- goto -> bb16; -+ bb15 (cleanup): { +- bb11: { ++ bb11 (cleanup): { + StorageDead(_14); -+ drop(_12) -> [return: bb16, unwind terminate(cleanup)]; - } - -- bb16: { -- StorageDead(_9); -+ bb16 (cleanup): { ++ drop(_12) -> [return: bb12, unwind terminate(cleanup)]; ++ } ++ ++ bb12 (cleanup): { + StorageDead(_12); + StorageDead(_10); - goto -> bb17; + StorageDead(_9); +- goto -> bb12; ++ goto -> bb13; } -- bb17: { -- StorageDead(_15); +- bb12: { ++ bb13 (cleanup): { + StorageDead(_15); - StorageDead(_11); - StorageDead(_8); -- goto -> bb21; -+ bb17 (cleanup): { -+ StorageDead(_9); -+ goto -> bb18; + goto -> bb15; } -- bb18: { -- goto -> bb19; -+ bb18 (cleanup): { -+ StorageDead(_15); -+ goto -> bb20; - } - -- bb19: { +- bb13: { - StorageDead(_4); -+ bb19 (cleanup): { +- goto -> bb14; +- } +- +- bb14: { +- StorageDead(_3); ++ bb14 (cleanup): { + StorageDead(_13); + StorageDead(_12); + StorageDead(_10); + StorageDead(_9); - goto -> bb20; + goto -> bb15; } -- bb20: { -- StorageDead(_3); -- goto -> bb21; -+ bb20 (cleanup): { +- bb15: { +- drop(_2) -> [return: bb16, unwind: bb30]; ++ bb15 (cleanup): { + StorageDead(_11); + StorageDead(_8); -+ goto -> bb26; ++ goto -> bb20; } -- bb21: { -- drop(_2) -> [return: bb22, unwind: bb38]; -+ bb21 (cleanup): { +- bb16: { +- drop(_1) -> [return: bb17, unwind: bb29]; ++ bb16 (cleanup): { + StorageDead(_7); -+ drop(_5) -> [return: bb23, unwind terminate(cleanup)]; - } - -- bb22: { -- drop(_1) -> [return: bb23, unwind: bb37]; -+ bb22 (cleanup): { -+ StorageDead(_6); -+ goto -> bb23; ++ drop(_5) -> [return: bb18, unwind terminate(cleanup)]; } -- bb23: { +- bb17: { - coroutine_drop; -+ bb23 (cleanup): { -+ StorageDead(_5); -+ goto -> bb24; ++ bb17 (cleanup): { ++ StorageDead(_6); ++ goto -> bb18; } - bb24 (cleanup): { + bb18 (cleanup): { - StorageDead(_14); -- drop(_12) -> [return: bb25, unwind terminate(cleanup)]; +- drop(_12) -> [return: bb19, unwind terminate(cleanup)]; ++ StorageDead(_5); + StorageDead(_4); -+ goto -> bb25; ++ goto -> bb19; } - bb25 (cleanup): { + bb19 (cleanup): { - StorageDead(_12); - StorageDead(_10); -+ StorageDead(_3); - goto -> bb26; - } - - bb26 (cleanup): { - StorageDead(_9); -- goto -> bb27; -+ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb27, unwind terminate(cleanup)]; ++ StorageDead(_3); + goto -> bb20; } - bb27 (cleanup): { + bb20 (cleanup): { - StorageDead(_15); -- goto -> bb29; -+ goto -> bb28; +- goto -> bb22; ++ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb21, unwind terminate(cleanup)]; } - bb28 (cleanup): { + bb21 (cleanup): { - StorageDead(_13); - StorageDead(_12); - StorageDead(_10); - StorageDead(_9); - goto -> bb29; + goto -> bb22; } - bb29 (cleanup): { + bb22 (cleanup): { - StorageDead(_11); - StorageDead(_8); -- goto -> bb35; +- goto -> bb27; ++ goto -> bb23; + } + + bb23 (cleanup): { +- StorageDead(_7); +- drop(_5) -> [return: bb25, unwind terminate(cleanup)]; + discriminant((*_18)) = 2; + resume; } -- bb30 (cleanup): { -- StorageDead(_7); -- drop(_5) -> [return: bb32, unwind terminate(cleanup)]; -+ bb30: { +- bb24 (cleanup): { +- StorageDead(_6); +- goto -> bb25; ++ bb24: { + StorageLive(_3); + StorageLive(_4); + _3 = move _2; -+ goto -> bb4; ++ goto -> bb3; } -- bb31 (cleanup): { -- StorageDead(_6); -- goto -> bb32; -+ bb31: { +- bb25 (cleanup): { +- StorageDead(_5); +- StorageDead(_4); +- goto -> bb26; ++ bb25: { + StorageLive(_8); + StorageLive(_9); + StorageLive(_11); + StorageLive(_15); + _8 = move _2; -+ goto -> bb10; ++ goto -> bb7; } -- bb32 (cleanup): { -- StorageDead(_5); -- goto -> bb33; -+ bb32: { -+ assert(const false, "coroutine resumed after panicking") -> [success: bb32, unwind continue]; +- bb26 (cleanup): { +- StorageDead(_3); +- goto -> bb27; ++ bb26: { ++ assert(const false, "coroutine resumed after panicking") -> [success: bb26, unwind continue]; } -- bb33 (cleanup): { -- StorageDead(_4); -- goto -> bb34; -+ bb33: { -+ assert(const false, "coroutine resumed after completion") -> [success: bb33, unwind continue]; +- bb27 (cleanup): { +- drop(_2) -> [return: bb28, unwind terminate(cleanup)]; ++ bb27: { ++ assert(const false, "coroutine resumed after completion") -> [success: bb27, unwind continue]; } -- bb34 (cleanup): { -- StorageDead(_3); -- goto -> bb35; -+ bb34: { +- bb28 (cleanup): { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb28: { + unreachable; } -- bb35 (cleanup): { -- drop(_2) -> [return: bb36, unwind terminate(cleanup)]; -- } -- -- bb36 (cleanup): { -- drop(_1) -> [return: bb37, unwind terminate(cleanup)]; -- } -- -- bb37 (cleanup): { +- bb29 (cleanup): { - resume; - } - -- bb38 (cleanup): { -- drop(_1) -> [return: bb37, unwind terminate(cleanup)]; -+ bb35: { +- bb30 (cleanup): { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb29: { + (((*_18) as variant#4).0: std::string::String) = move _2; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + StorageLive(_6); + _6 = &(((*_18) as variant#4).0: std::string::String); -+ _5 = ::clone(move _6) -> [return: bb1, unwind: bb22]; ++ _5 = ::clone(move _6) -> [return: bb1, unwind: bb17]; } } diff --git a/tests/mir-opt/coroutine/coroutine.main-{closure#1}.StateTransform.diff b/tests/mir-opt/coroutine/coroutine.main-{closure#1}.StateTransform.diff index d25c2f61b722a..e76054e2acb85 100644 --- a/tests/mir-opt/coroutine/coroutine.main-{closure#1}.StateTransform.diff +++ b/tests/mir-opt/coroutine/coroutine.main-{closure#1}.StateTransform.diff @@ -44,28 +44,24 @@ - StorageLive(_5); - StorageLive(_6); - _6 = &_2; -- _5 = ::clone(move _6) -> [return: bb1, unwind: bb31]; +- _5 = ::clone(move _6) -> [return: bb1, unwind: bb24]; + _18 = copy (_1.0: &mut {coroutine@$DIR/coroutine.rs:26:5: 26:18}); + _17 = discriminant((*_18)); -+ switchInt(move _17) -> [0: bb35, 1: bb33, 2: bb32, 3: bb30, 4: bb31, otherwise: bb34]; ++ switchInt(move _17) -> [0: bb29, 1: bb27, 2: bb26, 3: bb24, 4: bb25, otherwise: bb28]; } bb1: { StorageDead(_6); StorageLive(_7); -- _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb30]; -+ _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb21]; +- _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb23]; ++ _7 = Location::<'_>::caller() -> [return: bb2, unwind: bb16]; } bb2: { _4 = (const "first", move _5, move _7); StorageDead(_7); - goto -> bb3; - } - - bb3: { StorageDead(_5); -- _3 = yield(move _4) -> [resume: bb4, drop: bb18]; +- _3 = yield(move _4) -> [resume: bb3, drop: bb13]; + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Yielded(move _4); + StorageDead(_3); + StorageDead(_4); @@ -73,17 +69,13 @@ + return; } - bb4: { - goto -> bb5; - } - - bb5: { + bb3: { StorageDead(_4); -- drop(_3) -> [return: bb6, unwind: bb34]; -+ drop(_3) -> [return: bb6, unwind: bb25]; +- drop(_3) -> [return: bb4, unwind: bb26]; ++ drop(_3) -> [return: bb4, unwind: bb19]; } - bb6: { + bb4: { StorageDead(_3); StorageLive(_8); StorageLive(_9); @@ -94,30 +86,26 @@ StorageLive(_12); StorageLive(_13); - _13 = &_2; -- _12 = ::clone(move _13) -> [return: bb7, unwind: bb28]; +- _12 = ::clone(move _13) -> [return: bb5, unwind: bb21]; + _13 = &(((*_18) as variant#4).0: std::string::String); -+ _12 = ::clone(move _13) -> [return: bb7, unwind: bb19]; ++ _12 = ::clone(move _13) -> [return: bb5, unwind: bb14]; } - bb7: { + bb5: { StorageDead(_13); StorageLive(_14); StorageLive(_15); -- _15 = Location::<'_>::caller() -> [return: bb8, unwind: bb24]; -+ _15 = Location::<'_>::caller() -> [return: bb8, unwind: bb15]; +- _15 = Location::<'_>::caller() -> [return: bb6, unwind: bb18]; ++ _15 = Location::<'_>::caller() -> [return: bb6, unwind: bb11]; } - bb8: { + bb6: { _14 = &(*_15); _9 = (move _10, move _12, move _14); StorageDead(_14); - goto -> bb9; - } - - bb9: { StorageDead(_12); StorageDead(_10); -- _8 = yield(move _9) -> [resume: bb10, drop: bb15]; +- _8 = yield(move _9) -> [resume: bb7, drop: bb11]; + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Yielded(move _9); + StorageDead(_8); + StorageDead(_9); @@ -127,216 +115,192 @@ + return; } - bb10: { - goto -> bb11; - } - - bb11: { + bb7: { StorageDead(_9); -- drop(_8) -> [return: bb12, unwind: bb27]; -+ drop(_8) -> [return: bb12, unwind: bb18]; +- drop(_8) -> [return: bb8, unwind: bb20]; ++ drop(_8) -> [return: bb8, unwind: bb13]; } - bb12: { + bb8: { StorageDead(_15); StorageDead(_11); StorageDead(_8); - _0 = const (); -- drop(_2) -> [return: bb13, unwind: bb36]; +- drop(_2) -> [return: bb9, unwind: bb28]; + _16 = const (); -+ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb13, unwind: bb27]; ++ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb9, unwind: bb21]; } - bb13: { -- drop(_1) -> [return: bb14, unwind: bb37]; -+ goto -> bb14; + bb9: { +- drop(_1) -> [return: bb10, unwind: bb29]; ++ goto -> bb10; } - bb14: { + bb10: { + _0 = CoroutineState::<(&str, String, &Location<'_>), ()>::Complete(move _16); + discriminant((*_18)) = 1; return; } -- bb15: { -- goto -> bb16; -+ bb15 (cleanup): { +- bb11: { ++ bb11 (cleanup): { + StorageDead(_14); -+ drop(_12) -> [return: bb16, unwind terminate(cleanup)]; - } - -- bb16: { -- StorageDead(_9); -+ bb16 (cleanup): { ++ drop(_12) -> [return: bb12, unwind terminate(cleanup)]; ++ } ++ ++ bb12 (cleanup): { + StorageDead(_12); + StorageDead(_10); - goto -> bb17; + StorageDead(_9); +- goto -> bb12; ++ goto -> bb13; } -- bb17: { -- StorageDead(_15); +- bb12: { ++ bb13 (cleanup): { + StorageDead(_15); - StorageDead(_11); - StorageDead(_8); -- goto -> bb21; -+ bb17 (cleanup): { -+ StorageDead(_9); -+ goto -> bb18; + goto -> bb15; } -- bb18: { -- goto -> bb19; -+ bb18 (cleanup): { -+ StorageDead(_15); -+ goto -> bb20; - } - -- bb19: { +- bb13: { - StorageDead(_4); -+ bb19 (cleanup): { +- goto -> bb14; +- } +- +- bb14: { +- StorageDead(_3); ++ bb14 (cleanup): { + StorageDead(_13); + StorageDead(_12); + StorageDead(_10); + StorageDead(_9); - goto -> bb20; + goto -> bb15; } -- bb20: { -- StorageDead(_3); -- goto -> bb21; -+ bb20 (cleanup): { +- bb15: { +- drop(_2) -> [return: bb16, unwind: bb30]; ++ bb15 (cleanup): { + StorageDead(_11); + StorageDead(_8); -+ goto -> bb26; ++ goto -> bb20; } -- bb21: { -- drop(_2) -> [return: bb22, unwind: bb38]; -+ bb21 (cleanup): { +- bb16: { +- drop(_1) -> [return: bb17, unwind: bb29]; ++ bb16 (cleanup): { + StorageDead(_7); -+ drop(_5) -> [return: bb23, unwind terminate(cleanup)]; - } - -- bb22: { -- drop(_1) -> [return: bb23, unwind: bb37]; -+ bb22 (cleanup): { -+ StorageDead(_6); -+ goto -> bb23; ++ drop(_5) -> [return: bb18, unwind terminate(cleanup)]; } -- bb23: { +- bb17: { - coroutine_drop; -+ bb23 (cleanup): { -+ StorageDead(_5); -+ goto -> bb24; ++ bb17 (cleanup): { ++ StorageDead(_6); ++ goto -> bb18; } - bb24 (cleanup): { + bb18 (cleanup): { - StorageDead(_14); -- drop(_12) -> [return: bb25, unwind terminate(cleanup)]; +- drop(_12) -> [return: bb19, unwind terminate(cleanup)]; ++ StorageDead(_5); + StorageDead(_4); -+ goto -> bb25; ++ goto -> bb19; } - bb25 (cleanup): { + bb19 (cleanup): { - StorageDead(_12); - StorageDead(_10); -+ StorageDead(_3); - goto -> bb26; - } - - bb26 (cleanup): { - StorageDead(_9); -- goto -> bb27; -+ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb27, unwind terminate(cleanup)]; ++ StorageDead(_3); + goto -> bb20; } - bb27 (cleanup): { + bb20 (cleanup): { - StorageDead(_15); -- goto -> bb29; -+ goto -> bb28; +- goto -> bb22; ++ drop((((*_18) as variant#4).0: std::string::String)) -> [return: bb21, unwind terminate(cleanup)]; } - bb28 (cleanup): { + bb21 (cleanup): { - StorageDead(_13); - StorageDead(_12); - StorageDead(_10); - StorageDead(_9); - goto -> bb29; + goto -> bb22; } - bb29 (cleanup): { + bb22 (cleanup): { - StorageDead(_11); - StorageDead(_8); -- goto -> bb35; +- goto -> bb27; ++ goto -> bb23; + } + + bb23 (cleanup): { +- StorageDead(_7); +- drop(_5) -> [return: bb25, unwind terminate(cleanup)]; + discriminant((*_18)) = 2; + resume; } -- bb30 (cleanup): { -- StorageDead(_7); -- drop(_5) -> [return: bb32, unwind terminate(cleanup)]; -+ bb30: { +- bb24 (cleanup): { +- StorageDead(_6); +- goto -> bb25; ++ bb24: { + StorageLive(_3); + StorageLive(_4); + _3 = move _2; -+ goto -> bb4; ++ goto -> bb3; } -- bb31 (cleanup): { -- StorageDead(_6); -- goto -> bb32; -+ bb31: { +- bb25 (cleanup): { +- StorageDead(_5); +- StorageDead(_4); +- goto -> bb26; ++ bb25: { + StorageLive(_8); + StorageLive(_9); + StorageLive(_11); + StorageLive(_15); + _8 = move _2; -+ goto -> bb10; ++ goto -> bb7; } -- bb32 (cleanup): { -- StorageDead(_5); -- goto -> bb33; -+ bb32: { -+ assert(const false, "coroutine resumed after panicking") -> [success: bb32, unwind continue]; +- bb26 (cleanup): { +- StorageDead(_3); +- goto -> bb27; ++ bb26: { ++ assert(const false, "coroutine resumed after panicking") -> [success: bb26, unwind continue]; } -- bb33 (cleanup): { -- StorageDead(_4); -- goto -> bb34; -+ bb33: { -+ assert(const false, "coroutine resumed after completion") -> [success: bb33, unwind continue]; +- bb27 (cleanup): { +- drop(_2) -> [return: bb28, unwind terminate(cleanup)]; ++ bb27: { ++ assert(const false, "coroutine resumed after completion") -> [success: bb27, unwind continue]; } -- bb34 (cleanup): { -- StorageDead(_3); -- goto -> bb35; -+ bb34: { +- bb28 (cleanup): { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb28: { + unreachable; } -- bb35 (cleanup): { -- drop(_2) -> [return: bb36, unwind terminate(cleanup)]; -- } -- -- bb36 (cleanup): { -- drop(_1) -> [return: bb37, unwind terminate(cleanup)]; -- } -- -- bb37 (cleanup): { +- bb29 (cleanup): { - resume; - } - -- bb38 (cleanup): { -- drop(_1) -> [return: bb37, unwind terminate(cleanup)]; -+ bb35: { +- bb30 (cleanup): { +- drop(_1) -> [return: bb29, unwind terminate(cleanup)]; ++ bb29: { + (((*_18) as variant#4).0: std::string::String) = move _2; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + StorageLive(_6); + _6 = &(((*_18) as variant#4).0: std::string::String); -+ _5 = ::clone(move _6) -> [return: bb1, unwind: bb22]; ++ _5 = ::clone(move _6) -> [return: bb1, unwind: bb17]; } } diff --git a/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-abort.diff b/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-abort.diff index 8c0fbf60ca97c..7e41d72a13a92 100644 --- a/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-abort.diff +++ b/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-abort.diff @@ -48,10 +48,10 @@ - StorageLive(_5); - StorageLive(_6); - _6 = (); -- _5 = yield(move _6) -> [resume: bb1, drop: bb6]; +- _5 = yield(move _6) -> [resume: bb1, drop: bb5]; + _13 = copy (_1.0: &mut {coroutine@$DIR/coroutine_storage_dead_unwind.rs:24:5: 24:7}); + _12 = discriminant((*_13)); -+ switchInt(move _12) -> [0: bb9, 1: bb7, 3: bb6, otherwise: bb8]; ++ switchInt(move _12) -> [0: bb8, 1: bb6, 3: bb5, otherwise: bb7]; } bb1: { @@ -79,47 +79,43 @@ StorageDead(_9); - _0 = const (); - StorageDead(_4); +- StorageDead(_3); +- drop(_1) -> [return: bb4, unwind unreachable]; + _11 = const (); + nop; - goto -> bb4; - } - - bb4: { -- StorageDead(_3); -- drop(_1) -> [return: bb5, unwind unreachable]; + nop; -+ goto -> bb5; ++ goto -> bb4; } - bb5: { + bb4: { + _0 = CoroutineState::<(), ()>::Complete(move _11); + discriminant((*_13)) = 1; return; } - bb6: { + bb5: { - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); -- drop(_3) -> [return: bb7, unwind unreachable]; +- drop(_3) -> [return: bb6, unwind unreachable]; + StorageLive(_5); + StorageLive(_6); + _5 = move _2; + goto -> bb1; } - bb7: { + bb6: { - StorageDead(_3); -- drop(_1) -> [return: bb8, unwind unreachable]; -+ assert(const false, "coroutine resumed after completion") -> [success: bb7, unwind unreachable]; +- drop(_1) -> [return: bb7, unwind unreachable]; ++ assert(const false, "coroutine resumed after completion") -> [success: bb6, unwind unreachable]; } - bb8: { + bb7: { - coroutine_drop; + unreachable; + } + -+ bb9: { ++ bb8: { + nop; + (((*_13) as variant#3).0: Foo) = Foo(const 5_i32); + nop; diff --git a/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-unwind.diff b/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-unwind.diff index c0afae90bd28c..dc45e5aeb9fca 100644 --- a/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-unwind.diff +++ b/tests/mir-opt/coroutine/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.panic-unwind.diff @@ -48,10 +48,10 @@ - StorageLive(_5); - StorageLive(_6); - _6 = (); -- _5 = yield(move _6) -> [resume: bb1, drop: bb6]; +- _5 = yield(move _6) -> [resume: bb1, drop: bb5]; + _13 = copy (_1.0: &mut {coroutine@$DIR/coroutine_storage_dead_unwind.rs:24:5: 24:7}); + _12 = discriminant((*_13)); -+ switchInt(move _12) -> [0: bb17, 1: bb15, 2: bb14, 3: bb13, otherwise: bb16]; ++ switchInt(move _12) -> [0: bb14, 1: bb12, 2: bb11, 3: bb10, otherwise: bb13]; } bb1: { @@ -60,9 +60,9 @@ StorageLive(_7); StorageLive(_8); - _8 = move _3; -- _7 = take::(move _8) -> [return: bb2, unwind: bb10]; +- _7 = take::(move _8) -> [return: bb2, unwind: bb9]; + _8 = move (((*_13) as variant#3).0: Foo); -+ _7 = take::(move _8) -> [return: bb2, unwind: bb7]; ++ _7 = take::(move _8) -> [return: bb2, unwind: bb6]; } bb2: { @@ -71,9 +71,9 @@ StorageLive(_9); StorageLive(_10); - _10 = move _4; -- _9 = take::(move _10) -> [return: bb3, unwind: bb9]; +- _9 = take::(move _10) -> [return: bb3, unwind: bb8]; + _10 = move (((*_13) as variant#3).1: Bar); -+ _9 = take::(move _10) -> [return: bb3, unwind: bb6]; ++ _9 = take::(move _10) -> [return: bb3, unwind: bb5]; } bb3: { @@ -81,104 +81,92 @@ StorageDead(_9); - _0 = const (); - StorageDead(_4); +- StorageDead(_3); +- drop(_1) -> [return: bb4, unwind: bb11]; + _11 = const (); + nop; - goto -> bb4; - } - - bb4: { -- StorageDead(_3); -- drop(_1) -> [return: bb5, unwind: bb14]; + nop; -+ goto -> bb5; ++ goto -> bb4; } - bb5: { + bb4: { + _0 = CoroutineState::<(), ()>::Complete(move _11); + discriminant((*_13)) = 1; return; } -- bb6: { +- bb5: { - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); -- drop(_3) -> [return: bb7, unwind: bb15]; -+ bb6 (cleanup): { +- drop(_3) -> [return: bb6, unwind: bb12]; ++ bb5 (cleanup): { + StorageDead(_10); + StorageDead(_9); -+ goto -> bb9; ++ goto -> bb7; } -- bb7: { +- bb6: { - StorageDead(_3); -- drop(_1) -> [return: bb8, unwind: bb14]; -+ bb7 (cleanup): { -+ goto -> bb8; - } - -- bb8: { -- coroutine_drop; -+ bb8 (cleanup): { +- drop(_1) -> [return: bb7, unwind: bb11]; ++ bb6 (cleanup): { + StorageDead(_8); + StorageDead(_7); -+ goto -> bb9; ++ goto -> bb7; } - bb9 (cleanup): { -- StorageDead(_10); -- StorageDead(_9); -- goto -> bb12; +- bb7: { +- coroutine_drop; ++ bb7 (cleanup): { ++ nop; + nop; -+ goto -> bb10; ++ goto -> bb8; } - bb10 (cleanup): { -+ nop; - goto -> bb11; + bb8 (cleanup): { +- StorageDead(_10); +- StorageDead(_9); +- goto -> bb10; ++ goto -> bb9; } - bb11 (cleanup): { + bb9 (cleanup): { - StorageDead(_8); - StorageDead(_7); - goto -> bb12; - } - - bb12 (cleanup): { -- StorageDead(_4); -- goto -> bb13; +- goto -> bb10; + discriminant((*_13)) = 2; + resume; } -- bb13 (cleanup): { +- bb10 (cleanup): { +- StorageDead(_4); - StorageDead(_3); -- drop(_1) -> [return: bb14, unwind terminate(cleanup)]; -+ bb13: { +- drop(_1) -> [return: bb11, unwind terminate(cleanup)]; ++ bb10: { + StorageLive(_5); + StorageLive(_6); + _5 = move _2; + goto -> bb1; } -- bb14 (cleanup): { +- bb11 (cleanup): { - resume; -+ bb14: { -+ assert(const false, "coroutine resumed after panicking") -> [success: bb14, unwind continue]; ++ bb11: { ++ assert(const false, "coroutine resumed after panicking") -> [success: bb11, unwind continue]; } -- bb15 (cleanup): { +- bb12 (cleanup): { - StorageDead(_3); -- drop(_1) -> [return: bb14, unwind terminate(cleanup)]; -+ bb15: { -+ assert(const false, "coroutine resumed after completion") -> [success: bb15, unwind continue]; +- drop(_1) -> [return: bb11, unwind terminate(cleanup)]; ++ bb12: { ++ assert(const false, "coroutine resumed after completion") -> [success: bb12, unwind continue]; + } + -+ bb16: { ++ bb13: { + unreachable; + } + -+ bb17: { ++ bb14: { + nop; + (((*_13) as variant#3).0: Foo) = Foo(const 5_i32); + nop; diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff index 8ac6acd0e4a8b..b62a8ba8465c2 100644 --- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff +++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = f() -> [return: bb1, unwind: bb5]; + _2 = f() -> [return: bb1, unwind: bb4]; } bb1: { @@ -18,7 +18,7 @@ bb2: { StorageDead(_2); - drop(_1) -> [return: bb3, unwind: bb5]; + drop(_1) -> [return: bb3, unwind: bb4]; } bb3: { @@ -28,10 +28,6 @@ } bb4 (cleanup): { - drop(_2) -> [return: bb5, unwind terminate(cleanup)]; - } - - bb5 (cleanup): { resume; } } diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff index aa9fcb505e640..06e7797e7b8c5 100644 --- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff @@ -13,7 +13,7 @@ } bb1: { - _1 = Box::>::new(move _2) -> [return: bb2, unwind: bb4]; + _1 = Box::>::new(move _2) -> [return: bb2, unwind continue]; } bb2: { @@ -26,13 +26,5 @@ _0 = const (); return; } - - bb4 (cleanup): { - drop(_2) -> [return: bb5, unwind terminate(cleanup)]; - } - - bb5 (cleanup): { - resume; - } } diff --git a/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff index 61c034f2ad2ac..3e9635e305205 100644 --- a/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff @@ -9,6 +9,8 @@ let mut _4: isize; let _5: std::vec::Vec; let _6: u8; + let mut _7: bool; + let mut _8: isize; scope 1 { debug _trailers => _5; } @@ -17,8 +19,10 @@ } bb0: { + _7 = const false; + _7 = const true; _4 = discriminant(_1); - switchInt(move _4) -> [0: bb2, 1: bb4, otherwise: bb1]; + switchInt(copy _4) -> [0: bb2, 1: bb4, otherwise: bb1]; } bb1: { @@ -37,12 +41,12 @@ bb4: { _0 = const (); - goto -> bb9; + goto -> bb15; } bb5: { _0 = const (); - goto -> bb9; + goto -> bb15; } bb6: { @@ -50,7 +54,7 @@ _6 = copy ((((_1 as Ready).0: std::result::Result>, u8>) as Err).0: u8); _0 = const (); StorageDead(_6); - goto -> bb9; + goto -> bb15; } bb7: { @@ -62,7 +66,7 @@ bb8: { StorageDead(_5); - goto -> bb9; + goto -> bb15; } bb9: { @@ -72,5 +76,27 @@ bb10 (cleanup): { resume; } + + bb11: { + switchInt(copy _7) -> [0: bb12, otherwise: bb14]; + } + + bb12: { + _7 = const false; + goto -> bb9; + } + + bb13: { + goto -> bb12; + } + + bb14: { + _8 = discriminant(((_1 as Ready).0: std::result::Result>, u8>)); + switchInt(move _8) -> [0: bb13, otherwise: bb12]; + } + + bb15: { + switchInt(copy _4) -> [0: bb11, otherwise: bb9]; + } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index be89063a8ac96..03513728c2f15 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -21,7 +21,7 @@ bb0: { StorageLive(_2); _2 = move _1; -- _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; +- _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind continue]; + StorageLive(_3); + StorageLive(_4); + _3 = discriminant(_2); @@ -29,13 +29,9 @@ } bb1: { -- StorageDead(_2); -- return; + unreachable; - } - -- bb2 (cleanup): { -- resume; ++ } ++ + bb2: { + assume(UbChecks); + _4 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; @@ -45,8 +41,8 @@ + _0 = move ((_2 as Some).0: T); + StorageDead(_4); + StorageDead(_3); -+ StorageDead(_2); -+ return; + StorageDead(_2); + return; } } diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff index 06f06fd072186..3fde1fc3f64dd 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff @@ -21,7 +21,7 @@ StorageLive(_3); StorageLive(_4); _4 = S; - _3 = S::id(move _4) -> [return: bb1, unwind: bb4]; + _3 = S::id(move _4) -> [return: bb1, unwind: bb3]; } bb1: { @@ -40,28 +40,20 @@ } bb3 (cleanup): { - goto -> bb5; +- drop(_2) -> [return: bb4, unwind terminate(cleanup)]; ++ goto -> bb6; } bb4 (cleanup): { - goto -> bb5; - } - - bb5 (cleanup): { -- drop(_2) -> [return: bb6, unwind terminate(cleanup)]; -+ goto -> bb8; - } - - bb6 (cleanup): { resume; + } + -+ bb7 (cleanup): { -+ drop(_2) -> [return: bb6, unwind terminate(cleanup)]; ++ bb5 (cleanup): { ++ drop(_2) -> [return: bb4, unwind terminate(cleanup)]; + } + -+ bb8 (cleanup): { -+ switchInt(copy _5) -> [0: bb6, otherwise: bb7]; ++ bb6 (cleanup): { ++ switchInt(copy _5) -> [0: bb4, otherwise: bb5]; } } diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff index 06f06fd072186..3fde1fc3f64dd 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff @@ -21,7 +21,7 @@ StorageLive(_3); StorageLive(_4); _4 = S; - _3 = S::id(move _4) -> [return: bb1, unwind: bb4]; + _3 = S::id(move _4) -> [return: bb1, unwind: bb3]; } bb1: { @@ -40,28 +40,20 @@ } bb3 (cleanup): { - goto -> bb5; +- drop(_2) -> [return: bb4, unwind terminate(cleanup)]; ++ goto -> bb6; } bb4 (cleanup): { - goto -> bb5; - } - - bb5 (cleanup): { -- drop(_2) -> [return: bb6, unwind terminate(cleanup)]; -+ goto -> bb8; - } - - bb6 (cleanup): { resume; + } + -+ bb7 (cleanup): { -+ drop(_2) -> [return: bb6, unwind terminate(cleanup)]; ++ bb5 (cleanup): { ++ drop(_2) -> [return: bb4, unwind terminate(cleanup)]; + } + -+ bb8 (cleanup): { -+ switchInt(copy _5) -> [0: bb6, otherwise: bb7]; ++ bb6 (cleanup): { ++ switchInt(copy _5) -> [0: bb4, otherwise: bb5]; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff index 9b295834964d1..afd190484c18f 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff @@ -26,7 +26,7 @@ StorageLive(_3); StorageLive(_4); _4 = move _2; - _3 = std::mem::drop::(move _4) -> [return: bb1, unwind: bb7]; + _3 = std::mem::drop::(move _4) -> [return: bb1, unwind: bb3]; } bb1: { @@ -35,60 +35,39 @@ StorageLive(_5); + _6 = const false; _5 = move _1; - goto -> bb2; - } - - bb2: { - _2 = move _5; - goto -> bb4; - } - - bb3 (cleanup): { _2 = move _5; - goto -> bb8; - } - - bb4: { StorageDead(_5); _0 = const (); - drop(_2) -> [return: bb5, unwind: bb9]; + drop(_2) -> [return: bb2, unwind: bb4]; } - bb5: { + bb2: { StorageDead(_2); - goto -> bb6; - } - - bb6: { + _6 = const false; StorageDead(_1); return; } - bb7 (cleanup): { - goto -> bb8; - } - - bb8 (cleanup): { -- drop(_2) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb9; + bb3 (cleanup): { +- drop(_2) -> [return: bb4, unwind terminate(cleanup)]; ++ goto -> bb4; } - bb9 (cleanup): { -- drop(_1) -> [return: bb10, unwind terminate(cleanup)]; -+ goto -> bb12; + bb4 (cleanup): { +- drop(_1) -> [return: bb5, unwind terminate(cleanup)]; ++ goto -> bb7; } - bb10 (cleanup): { + bb5 (cleanup): { resume; + } + -+ bb11 (cleanup): { -+ drop(_1) -> [return: bb10, unwind terminate(cleanup)]; ++ bb6 (cleanup): { ++ drop(_1) -> [return: bb5, unwind terminate(cleanup)]; + } + -+ bb12 (cleanup): { -+ switchInt(copy _6) -> [0: bb10, otherwise: bb11]; ++ bb7 (cleanup): { ++ switchInt(copy _6) -> [0: bb5, otherwise: bb6]; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff index 9b295834964d1..afd190484c18f 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff @@ -26,7 +26,7 @@ StorageLive(_3); StorageLive(_4); _4 = move _2; - _3 = std::mem::drop::(move _4) -> [return: bb1, unwind: bb7]; + _3 = std::mem::drop::(move _4) -> [return: bb1, unwind: bb3]; } bb1: { @@ -35,60 +35,39 @@ StorageLive(_5); + _6 = const false; _5 = move _1; - goto -> bb2; - } - - bb2: { - _2 = move _5; - goto -> bb4; - } - - bb3 (cleanup): { _2 = move _5; - goto -> bb8; - } - - bb4: { StorageDead(_5); _0 = const (); - drop(_2) -> [return: bb5, unwind: bb9]; + drop(_2) -> [return: bb2, unwind: bb4]; } - bb5: { + bb2: { StorageDead(_2); - goto -> bb6; - } - - bb6: { + _6 = const false; StorageDead(_1); return; } - bb7 (cleanup): { - goto -> bb8; - } - - bb8 (cleanup): { -- drop(_2) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb9; + bb3 (cleanup): { +- drop(_2) -> [return: bb4, unwind terminate(cleanup)]; ++ goto -> bb4; } - bb9 (cleanup): { -- drop(_1) -> [return: bb10, unwind terminate(cleanup)]; -+ goto -> bb12; + bb4 (cleanup): { +- drop(_1) -> [return: bb5, unwind terminate(cleanup)]; ++ goto -> bb7; } - bb10 (cleanup): { + bb5 (cleanup): { resume; + } + -+ bb11 (cleanup): { -+ drop(_1) -> [return: bb10, unwind terminate(cleanup)]; ++ bb6 (cleanup): { ++ drop(_1) -> [return: bb5, unwind terminate(cleanup)]; + } + -+ bb12 (cleanup): { -+ switchInt(copy _6) -> [0: bb10, otherwise: bb11]; ++ bb7 (cleanup): { ++ switchInt(copy _6) -> [0: bb5, otherwise: bb6]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff index 3cbcca7e16921..f0740bb2427cb 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff @@ -25,11 +25,11 @@ + _8 = const false; StorageLive(_1); StorageLive(_2); - _2 = cond() -> [return: bb1, unwind: bb11]; + _2 = cond() -> [return: bb1, unwind: bb8]; } bb1: { - switchInt(move _2) -> [0: bb8, otherwise: bb2]; + switchInt(move _2) -> [0: bb5, otherwise: bb2]; } bb2: { @@ -38,99 +38,84 @@ _4 = K; _3 = E::F(move _4); StorageDead(_4); - goto -> bb3; - } - - bb3: { -+ _7 = const true; -+ _8 = const true; - _1 = move _3; - goto -> bb5; - } - - bb4 (cleanup): { + _7 = const true; + _8 = const true; _1 = move _3; - goto -> bb11; - } - - bb5: { StorageDead(_3); PlaceMention(_1); _5 = discriminant(_1); - switchInt(move _5) -> [0: bb6, otherwise: bb7]; + switchInt(move _5) -> [0: bb4, otherwise: bb3]; } - bb6: { - StorageLive(_6); - _6 = move ((_1 as F).0: K); + bb3: { _0 = const (); - StorageDead(_6); - goto -> bb9; + goto -> bb6; } - bb7: { + bb4: { + StorageLive(_6); + _6 = move ((_1 as F).0: K); _0 = const (); - goto -> bb9; + StorageDead(_6); + goto -> bb6; } - bb8: { + bb5: { _0 = const (); - goto -> bb9; + goto -> bb6; } - bb9: { + bb6: { StorageDead(_2); -- drop(_1) -> [return: bb10, unwind: bb12]; -+ goto -> bb17; +- drop(_1) -> [return: bb7, unwind: bb9]; ++ goto -> bb14; } - bb10: { + bb7: { + _7 = const false; + _8 = const false; StorageDead(_1); return; } - bb11 (cleanup): { -- drop(_1) -> [return: bb12, unwind terminate(cleanup)]; -+ goto -> bb12; + bb8 (cleanup): { +- drop(_1) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb9; } - bb12 (cleanup): { + bb9 (cleanup): { resume; + } + -+ bb13: { ++ bb10: { + _7 = const false; -+ goto -> bb10; ++ goto -> bb7; + } + -+ bb14: { -+ drop(_1) -> [return: bb13, unwind: bb12]; ++ bb11: { ++ drop(_1) -> [return: bb10, unwind: bb9]; + } + -+ bb15 (cleanup): { -+ drop(_1) -> [return: bb12, unwind terminate(cleanup)]; ++ bb12 (cleanup): { ++ drop(_1) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb16: { ++ bb13: { + _9 = discriminant(_1); -+ switchInt(move _9) -> [0: bb13, otherwise: bb14]; ++ switchInt(move _9) -> [0: bb10, otherwise: bb11]; + } + -+ bb17: { -+ switchInt(copy _7) -> [0: bb13, otherwise: bb16]; ++ bb14: { ++ switchInt(copy _7) -> [0: bb10, otherwise: bb13]; + } + -+ bb18 (cleanup): { ++ bb15 (cleanup): { + _10 = discriminant(_1); -+ switchInt(move _10) -> [0: bb12, otherwise: bb15]; ++ switchInt(move _10) -> [0: bb9, otherwise: bb12]; + } + -+ bb19 (cleanup): { -+ switchInt(copy _7) -> [0: bb12, otherwise: bb18]; ++ bb16 (cleanup): { ++ switchInt(copy _7) -> [0: bb9, otherwise: bb15]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff index aacf1cafa67b9..932b6950c1157 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff @@ -25,11 +25,11 @@ + _8 = const false; StorageLive(_1); StorageLive(_2); - _2 = cond() -> [return: bb1, unwind: bb11]; + _2 = cond() -> [return: bb1, unwind: bb8]; } bb1: { - switchInt(move _2) -> [0: bb8, otherwise: bb2]; + switchInt(move _2) -> [0: bb5, otherwise: bb2]; } bb2: { @@ -38,99 +38,84 @@ _4 = K; _3 = E::F(move _4); StorageDead(_4); - goto -> bb3; - } - - bb3: { -+ _7 = const true; -+ _8 = const true; - _1 = move _3; - goto -> bb5; - } - - bb4 (cleanup): { + _7 = const true; + _8 = const true; _1 = move _3; - goto -> bb11; - } - - bb5: { StorageDead(_3); PlaceMention(_1); _5 = discriminant(_1); - switchInt(move _5) -> [0: bb6, otherwise: bb7]; + switchInt(move _5) -> [0: bb4, otherwise: bb3]; } - bb6: { - StorageLive(_6); - _6 = move ((_1 as F).0: K); + bb3: { _0 = const (); - StorageDead(_6); - goto -> bb9; + goto -> bb6; } - bb7: { + bb4: { + StorageLive(_6); + _6 = move ((_1 as F).0: K); _0 = const (); - goto -> bb9; + StorageDead(_6); + goto -> bb6; } - bb8: { + bb5: { _0 = const (); - goto -> bb9; + goto -> bb6; } - bb9: { + bb6: { StorageDead(_2); -- drop(_1) -> [return: bb10, unwind continue]; -+ goto -> bb17; +- drop(_1) -> [return: bb7, unwind continue]; ++ goto -> bb14; } - bb10: { + bb7: { + _7 = const false; + _8 = const false; StorageDead(_1); return; } - bb11 (cleanup): { -- drop(_1) -> [return: bb12, unwind terminate(cleanup)]; -+ goto -> bb12; + bb8 (cleanup): { +- drop(_1) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb9; } - bb12 (cleanup): { + bb9 (cleanup): { resume; + } + -+ bb13: { ++ bb10: { + _7 = const false; -+ goto -> bb10; ++ goto -> bb7; + } + -+ bb14: { -+ drop(_1) -> [return: bb13, unwind: bb12]; ++ bb11: { ++ drop(_1) -> [return: bb10, unwind: bb9]; + } + -+ bb15 (cleanup): { -+ drop(_1) -> [return: bb12, unwind terminate(cleanup)]; ++ bb12 (cleanup): { ++ drop(_1) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb16: { ++ bb13: { + _9 = discriminant(_1); -+ switchInt(move _9) -> [0: bb13, otherwise: bb14]; ++ switchInt(move _9) -> [0: bb10, otherwise: bb11]; + } + -+ bb17: { -+ switchInt(copy _7) -> [0: bb13, otherwise: bb16]; ++ bb14: { ++ switchInt(copy _7) -> [0: bb10, otherwise: bb13]; + } + -+ bb18 (cleanup): { ++ bb15 (cleanup): { + _10 = discriminant(_1); -+ switchInt(move _10) -> [0: bb12, otherwise: bb15]; ++ switchInt(move _10) -> [0: bb9, otherwise: bb12]; + } + -+ bb19 (cleanup): { -+ switchInt(copy _7) -> [0: bb12, otherwise: bb18]; ++ bb16 (cleanup): { ++ switchInt(copy _7) -> [0: bb9, otherwise: bb15]; } } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir index 968334753db40..db3cf4cde7507 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir @@ -28,7 +28,7 @@ fn test() -> Option> { StorageLive(_1); StorageLive(_2); StorageLive(_3); - _3 = Box::<[u32; 1]>::new_uninit() -> [return: bb1, unwind: bb14]; + _3 = Box::<[u32; 1]>::new_uninit() -> [return: bb1, unwind: bb12]; } bb1: { @@ -36,7 +36,7 @@ fn test() -> Option> { StorageLive(_5); StorageLive(_6); _6 = Option::::None; - _5 = as Try>::branch(move _6) -> [return: bb2, unwind: bb13]; + _5 = as Try>::branch(move _6) -> [return: bb2, unwind: bb11]; } bb2: { @@ -58,7 +58,8 @@ fn test() -> Option> { ((((*_3).1: std::mem::ManuallyDrop<[u32; 1]>).0: std::mem::MaybeDangling<[u32; 1]>).0: [u32; 1]) = [move _4]; StorageDead(_4); _2 = move _3; - goto -> bb7; + StorageDead(_3); + _1 = std::boxed::box_assume_init_into_vec_unsafe::(move _2) -> [return: bb7, unwind: bb10]; } bb5: { @@ -66,54 +67,45 @@ fn test() -> Option> { _8 = copy ((_5 as Break).0: std::option::Option); StorageLive(_10); _10 = copy _8; - _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; + _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb11]; } bb6: { StorageDead(_10); StorageDead(_8); StorageDead(_4); - drop(_3) -> [return: bb10, unwind: bb14]; + drop(_3) -> [return: bb8, unwind: bb12]; } bb7: { - StorageDead(_3); - _1 = std::boxed::box_assume_init_into_vec_unsafe::(move _2) -> [return: bb8, unwind: bb12]; - } - - bb8: { StorageDead(_2); _0 = Option::>::Some(move _1); - goto -> bb9; - } - - bb9: { StorageDead(_1); StorageDead(_5); - goto -> bb11; + goto -> bb9; } - bb10: { + bb8: { StorageDead(_3); StorageDead(_2); StorageDead(_1); StorageDead(_5); - goto -> bb11; + goto -> bb9; } - bb11: { + bb9: { return; } - bb12 (cleanup): { - goto -> bb14; + bb10 (cleanup): { + goto -> bb12; } - bb13 (cleanup): { - drop(_3) -> [return: bb14, unwind terminate(cleanup)]; + bb11 (cleanup): { + drop(_3) -> [return: bb12, unwind terminate(cleanup)]; } - bb14 (cleanup): { + bb12 (cleanup): { resume; } } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir index 1fc75018c8625..c08dd901128a8 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir @@ -36,7 +36,7 @@ fn test() -> Option> { StorageLive(_5); StorageLive(_6); _6 = Option::::None; - _5 = as Try>::branch(move _6) -> [return: bb2, unwind: bb13]; + _5 = as Try>::branch(move _6) -> [return: bb2, unwind: bb11]; } bb2: { @@ -58,7 +58,8 @@ fn test() -> Option> { ((((*_3).1: std::mem::ManuallyDrop<[u32; 1]>).0: std::mem::MaybeDangling<[u32; 1]>).0: [u32; 1]) = [move _4]; StorageDead(_4); _2 = move _3; - goto -> bb7; + StorageDead(_3); + _1 = std::boxed::box_assume_init_into_vec_unsafe::(move _2) -> [return: bb7, unwind: bb10]; } bb5: { @@ -66,54 +67,45 @@ fn test() -> Option> { _8 = copy ((_5 as Break).0: std::option::Option); StorageLive(_10); _10 = copy _8; - _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; + _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb11]; } bb6: { StorageDead(_10); StorageDead(_8); StorageDead(_4); - drop(_3) -> [return: bb10, unwind: bb14]; + drop(_3) -> [return: bb8, unwind: bb12]; } bb7: { - StorageDead(_3); - _1 = std::boxed::box_assume_init_into_vec_unsafe::(move _2) -> [return: bb8, unwind: bb12]; - } - - bb8: { StorageDead(_2); _0 = Option::>::Some(move _1); - goto -> bb9; - } - - bb9: { StorageDead(_1); StorageDead(_5); - goto -> bb11; + goto -> bb9; } - bb10: { + bb8: { StorageDead(_3); StorageDead(_2); StorageDead(_1); StorageDead(_5); - goto -> bb11; + goto -> bb9; } - bb11: { + bb9: { return; } - bb12 (cleanup): { - goto -> bb14; + bb10 (cleanup): { + goto -> bb12; } - bb13 (cleanup): { - drop(_3) -> [return: bb14, unwind terminate(cleanup)]; + bb11 (cleanup): { + drop(_3) -> [return: bb12, unwind terminate(cleanup)]; } - bb14 (cleanup): { + bb12 (cleanup): { resume; } } diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff index 7d300e6c66b3c..1df11b448d3b9 100644 --- a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff @@ -16,10 +16,6 @@ bb1: { StorageDead(_2); - goto -> bb2; - } - - bb2: { return; } } diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff index 7d300e6c66b3c..1df11b448d3b9 100644 --- a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff @@ -16,10 +16,6 @@ bb1: { StorageDead(_2); - goto -> bb2; - } - - bb2: { return; } } diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 3b5b917af5c75..468cb19323180 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -110,8 +110,8 @@ - bb10: { + bb7: { _0 = const 1_i32; -- drop(_7) -> [return: bb19, unwind: bb25]; -+ drop(_7) -> [return: bb16, unwind: bb22]; +- drop(_7) -> [return: bb19, unwind: bb24]; ++ drop(_7) -> [return: bb16, unwind: bb21]; } - bb11: { @@ -119,8 +119,8 @@ _0 = const 3_i32; StorageDead(_10); StorageDead(_9); -- goto -> bb23; -+ goto -> bb20; +- goto -> bb22; ++ goto -> bb19; } - bb12: { @@ -161,8 +161,8 @@ _0 = const 3_i32; StorageDead(_13); StorageDead(_12); -- goto -> bb23; -+ goto -> bb20; +- goto -> bb22; ++ goto -> bb19; } - bb16: { @@ -204,52 +204,40 @@ StorageDead(_5); StorageDead(_8); StorageDead(_6); -- goto -> bb22; -+ goto -> bb19; +- goto -> bb23; ++ goto -> bb20; } - bb20: { + bb17: { _0 = const 2_i32; -- drop(_16) -> [return: bb21, unwind: bb25]; -+ drop(_16) -> [return: bb18, unwind: bb22]; +- drop(_16) -> [return: bb21, unwind: bb24]; ++ drop(_16) -> [return: bb18, unwind: bb21]; } - bb21: { + bb18: { StorageDead(_16); StorageDead(_15); -- goto -> bb22; -+ goto -> bb19; +- goto -> bb23; ++ goto -> bb20; } - bb22: { -- drop(_2) -> [return: bb24, unwind: bb26]; + bb19: { -+ goto -> bb21; - } - -- bb23: { -+ bb20: { StorageDead(_8); StorageDead(_6); -- drop(_2) -> [return: bb24, unwind: bb26]; -+ drop(_2) -> [return: bb21, unwind: bb23]; +- drop(_2) -> [return: bb23, unwind: bb24]; ++ drop(_2) -> [return: bb20, unwind: bb21]; } -- bb24: { -+ bb21: { +- bb23: { ++ bb20: { return; } -- bb25 (cleanup): { -- drop(_2) -> [return: bb26, unwind terminate(cleanup)]; -+ bb22 (cleanup): { -+ goto -> bb23; - } - -- bb26 (cleanup): { -+ bb23 (cleanup): { +- bb24 (cleanup): { ++ bb21 (cleanup): { resume; } } diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 3b5b917af5c75..468cb19323180 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -110,8 +110,8 @@ - bb10: { + bb7: { _0 = const 1_i32; -- drop(_7) -> [return: bb19, unwind: bb25]; -+ drop(_7) -> [return: bb16, unwind: bb22]; +- drop(_7) -> [return: bb19, unwind: bb24]; ++ drop(_7) -> [return: bb16, unwind: bb21]; } - bb11: { @@ -119,8 +119,8 @@ _0 = const 3_i32; StorageDead(_10); StorageDead(_9); -- goto -> bb23; -+ goto -> bb20; +- goto -> bb22; ++ goto -> bb19; } - bb12: { @@ -161,8 +161,8 @@ _0 = const 3_i32; StorageDead(_13); StorageDead(_12); -- goto -> bb23; -+ goto -> bb20; +- goto -> bb22; ++ goto -> bb19; } - bb16: { @@ -204,52 +204,40 @@ StorageDead(_5); StorageDead(_8); StorageDead(_6); -- goto -> bb22; -+ goto -> bb19; +- goto -> bb23; ++ goto -> bb20; } - bb20: { + bb17: { _0 = const 2_i32; -- drop(_16) -> [return: bb21, unwind: bb25]; -+ drop(_16) -> [return: bb18, unwind: bb22]; +- drop(_16) -> [return: bb21, unwind: bb24]; ++ drop(_16) -> [return: bb18, unwind: bb21]; } - bb21: { + bb18: { StorageDead(_16); StorageDead(_15); -- goto -> bb22; -+ goto -> bb19; +- goto -> bb23; ++ goto -> bb20; } - bb22: { -- drop(_2) -> [return: bb24, unwind: bb26]; + bb19: { -+ goto -> bb21; - } - -- bb23: { -+ bb20: { StorageDead(_8); StorageDead(_6); -- drop(_2) -> [return: bb24, unwind: bb26]; -+ drop(_2) -> [return: bb21, unwind: bb23]; +- drop(_2) -> [return: bb23, unwind: bb24]; ++ drop(_2) -> [return: bb20, unwind: bb21]; } -- bb24: { -+ bb21: { +- bb23: { ++ bb20: { return; } -- bb25 (cleanup): { -- drop(_2) -> [return: bb26, unwind terminate(cleanup)]; -+ bb22 (cleanup): { -+ goto -> bb23; - } - -- bb26 (cleanup): { -+ bb23 (cleanup): { +- bb24 (cleanup): { ++ bb21 (cleanup): { resume; } } diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir index 98e359a7d80a8..ef56d6fe5fdcd 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -14,7 +14,7 @@ fn main() -> () { StorageLive(_4); _4 = const ""; _3 = &(*_4); - _2 = ::to_string(move _3) -> [return: bb1, unwind: bb4]; + _2 = ::to_string(move _3) -> [return: bb1, unwind: bb3]; } bb1: { @@ -31,10 +31,6 @@ fn main() -> () { } bb3 (cleanup): { - goto -> bb4; - } - - bb4 (cleanup): { resume; } } diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index dc3ba1acc069a..c93cf6e2d2eba 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -19,7 +19,7 @@ fn main() -> () { bb1: { StorageDead(_3); - _1 = std::mem::drop::(move _2) -> [return: bb2, unwind: bb3]; + _1 = std::mem::drop::(move _2) -> [return: bb2, unwind continue]; } bb2: { @@ -29,14 +29,6 @@ fn main() -> () { _0 = const (); return; } - - bb3 (cleanup): { - goto -> bb4; - } - - bb4 (cleanup): { - resume; - } } ALLOC0 (size: 0, align: 1) {} diff --git a/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff b/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff index 1b73781b0a18e..9299f7353d84e 100644 --- a/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff +++ b/tests/mir-opt/otherwise_drops.result_ok.ElaborateDrops.diff @@ -7,11 +7,14 @@ let mut _2: isize; let _3: std::string::String; let mut _4: std::string::String; ++ let mut _5: bool; scope 1 { debug s => _3; } bb0: { ++ _5 = const false; ++ _5 = const true; PlaceMention(_1); _2 = discriminant(_1); switchInt(move _2) -> [0: bb2, otherwise: bb1]; @@ -19,7 +22,7 @@ bb1: { _0 = Option::::None; - goto -> bb5; + goto -> bb3; } bb2: { @@ -28,36 +31,21 @@ StorageLive(_4); _4 = move _3; _0 = Option::::Some(move _4); + StorageDead(_4); + StorageDead(_3); goto -> bb3; } bb3: { - StorageDead(_4); - goto -> bb4; +- drop(_1) -> [return: bb4, unwind: bb5]; ++ goto -> bb4; } bb4: { - StorageDead(_3); - goto -> bb5; - } - - bb5: { - goto -> bb6; - } - - bb6: { return; } - bb7 (cleanup): { - goto -> bb8; - } - - bb8 (cleanup): { - goto -> bb9; - } - - bb9 (cleanup): { + bb5 (cleanup): { resume; } } diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index 87340ebf0b90f..c4b11c471a8ba 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -89,10 +89,15 @@ - _6 = copy (_1.1: u32); + _6 = copy _31; _7 = discriminant(_5); - switchInt(move _7) -> [0: bb2, otherwise: bb7]; + switchInt(move _7) -> [0: bb3, otherwise: bb2]; } bb2: { + _0 = const (); + goto -> bb9; + } + + bb3: { StorageLive(_8); _8 = move ((_5 as Ok).0: std::boxed::Box); StorageLive(_9); @@ -118,20 +123,20 @@ - _24 = no_retag copy (_12.0: &std::boxed::Box); + _24 = no_retag copy _32; _17 = &(*_24); - _16 = core::fmt::rt::Argument::<'_>::new_display::>(move _17) -> [return: bb3, unwind unreachable]; + _16 = core::fmt::rt::Argument::<'_>::new_display::>(move _17) -> [return: bb4, unwind unreachable]; } - bb3: { + bb4: { StorageDead(_17); StorageLive(_18); StorageLive(_19); - _25 = no_retag copy (_12.1: &u32); + _25 = no_retag copy _33; _19 = &(*_25); - _18 = core::fmt::rt::Argument::<'_>::new_display::(move _19) -> [return: bb4, unwind unreachable]; + _18 = core::fmt::rt::Argument::<'_>::new_display::(move _19) -> [return: bb5, unwind unreachable]; } - bb4: { + bb5: { StorageDead(_19); _15 = [move _16, move _18]; StorageDead(_18); @@ -144,18 +149,18 @@ StorageLive(_23); _23 = &_15; _22 = &(*_23); - _11 = Arguments::<'_>::new::<7, 2>(move _20, move _22) -> [return: bb5, unwind unreachable]; + _11 = Arguments::<'_>::new::<7, 2>(move _20, move _22) -> [return: bb6, unwind unreachable]; } - bb5: { + bb6: { StorageDead(_23); StorageDead(_22); StorageDead(_21); StorageDead(_20); - _10 = std::io::_eprint(move _11) -> [return: bb6, unwind unreachable]; + _10 = std::io::_eprint(move _11) -> [return: bb7, unwind unreachable]; } - bb6: { + bb7: { StorageDead(_11); StorageDead(_15); - StorageDead(_12); @@ -169,11 +174,6 @@ drop(_8) -> [return: bb8, unwind unreachable]; } - bb7: { - _0 = const (); - goto -> bb9; - } - bb8: { StorageDead(_8); goto -> bb9; diff --git a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff index bc38a219ef3c5..8e549bc21884a 100644 --- a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff @@ -23,22 +23,22 @@ StorageDead(_4); StorageDead(_3); _1 = move (_2.1: Tag); - drop(_1) -> [return: bb1, unwind unreachable]; + drop(_1) -> [return: bb3, unwind unreachable]; } bb1: { - drop((_2.0: Tag)) -> [return: bb3, unwind unreachable]; - } - - bb2: { StorageDead(_2); StorageDead(_1); _0 = const (); return; } + bb2: { + drop((_2.2: Tag)) -> [return: bb1, unwind unreachable]; + } + bb3: { - drop((_2.2: Tag)) -> [return: bb2, unwind unreachable]; + drop((_2.0: Tag)) -> [return: bb2, unwind unreachable]; } } diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff index 12739fcf3e651..d5c1675758a4a 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff @@ -27,20 +27,20 @@ bb0: { + _8 = const false; StorageLive(_2); - _2 = String::new() -> [return: bb1, unwind: bb12]; + _2 = String::new() -> [return: bb1, unwind: bb10]; } bb1: { StorageLive(_3); _3 = const 12_i32; StorageLive(_4); - _4 = String::new() -> [return: bb2, unwind: bb11]; + _4 = String::new() -> [return: bb2, unwind: bb9]; } bb2: { + _8 = const true; StorageLive(_5); - _5 = String::new() -> [return: bb3, unwind: bb10]; + _5 = String::new() -> [return: bb3, unwind: bb8]; } bb3: { @@ -48,58 +48,50 @@ StorageLive(_7); + _8 = const false; _7 = move _4; - _6 = std::mem::drop::(move _7) -> [return: bb4, unwind: bb8]; + _6 = std::mem::drop::(move _7) -> [return: bb4, unwind: bb7]; } bb4: { StorageDead(_7); StorageDead(_6); - drop(_5) -> [return: bb5, unwind: bb10]; + drop(_5) -> [return: bb5, unwind: bb8]; } bb5: { StorageDead(_5); - goto -> bb6; - } - - bb6: { + _8 = const false; StorageDead(_4); - drop(_2) -> [return: bb7, unwind: bb12]; + drop(_2) -> [return: bb6, unwind: bb10]; } - bb7: { + bb6: { StorageDead(_2); tailcall g(); } + bb7 (cleanup): { + drop(_5) -> [return: bb8, unwind terminate(cleanup)]; + } + bb8 (cleanup): { - goto -> bb9; +- drop(_4) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb12; } bb9 (cleanup): { - drop(_5) -> [return: bb10, unwind terminate(cleanup)]; + drop(_2) -> [return: bb10, unwind terminate(cleanup)]; } bb10 (cleanup): { -- drop(_4) -> [return: bb11, unwind terminate(cleanup)]; -+ goto -> bb14; - } - - bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; - } - - bb12 (cleanup): { resume; + } + -+ bb13 (cleanup): { -+ drop(_4) -> [return: bb11, unwind terminate(cleanup)]; ++ bb11 (cleanup): { ++ drop(_4) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb14 (cleanup): { -+ switchInt(copy _8) -> [0: bb11, otherwise: bb13]; ++ bb12 (cleanup): { ++ switchInt(copy _8) -> [0: bb9, otherwise: bb11]; } } diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff index ab3fdc0235727..8e96e26bee61c 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff @@ -34,13 +34,13 @@ StorageLive(_3); _3 = const 12_i32; StorageLive(_4); - _4 = String::new() -> [return: bb2, unwind: bb11]; + _4 = String::new() -> [return: bb2, unwind: bb9]; } bb2: { + _8 = const true; StorageLive(_5); - _5 = String::new() -> [return: bb3, unwind: bb10]; + _5 = String::new() -> [return: bb3, unwind: bb8]; } bb3: { @@ -48,59 +48,51 @@ StorageLive(_7); + _8 = const false; _7 = move _4; - _6 = std::mem::drop::(move _7) -> [return: bb4, unwind: bb8]; + _6 = std::mem::drop::(move _7) -> [return: bb4, unwind: bb7]; } bb4: { StorageDead(_7); StorageDead(_6); - drop(_5) -> [return: bb5, unwind: bb10]; + drop(_5) -> [return: bb5, unwind: bb8]; } bb5: { StorageDead(_5); - goto -> bb6; - } - - bb6: { + _8 = const false; StorageDead(_4); -- drop(_2) -> [return: bb7, unwind continue]; -+ drop(_2) -> [return: bb7, unwind: bb12]; +- drop(_2) -> [return: bb6, unwind continue]; ++ drop(_2) -> [return: bb6, unwind: bb10]; } - bb7: { + bb6: { StorageDead(_2); tailcall g(); } + bb7 (cleanup): { + drop(_5) -> [return: bb8, unwind terminate(cleanup)]; + } + bb8 (cleanup): { - goto -> bb9; +- drop(_4) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb12; } bb9 (cleanup): { - drop(_5) -> [return: bb10, unwind terminate(cleanup)]; + drop(_2) -> [return: bb10, unwind terminate(cleanup)]; } bb10 (cleanup): { -- drop(_4) -> [return: bb11, unwind terminate(cleanup)]; -+ goto -> bb14; - } - - bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; - } - - bb12 (cleanup): { resume; + } + -+ bb13 (cleanup): { -+ drop(_4) -> [return: bb11, unwind terminate(cleanup)]; ++ bb11 (cleanup): { ++ drop(_4) -> [return: bb9, unwind terminate(cleanup)]; + } + -+ bb14 (cleanup): { -+ switchInt(copy _8) -> [0: bb11, otherwise: bb13]; ++ bb12 (cleanup): { ++ switchInt(copy _8) -> [0: bb9, otherwise: bb11]; } } diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff index fc5b71e3d1440..bdb8031557b35 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff @@ -31,20 +31,20 @@ bb0: { + _12 = const false; StorageLive(_4); - _4 = String::new() -> [return: bb1, unwind: bb27]; + _4 = String::new() -> [return: bb1, unwind: bb23]; } bb1: { StorageLive(_5); _5 = const 12_i32; StorageLive(_6); - _6 = String::new() -> [return: bb2, unwind: bb26]; + _6 = String::new() -> [return: bb2, unwind: bb22]; } bb2: { + _12 = const true; StorageLive(_7); - _7 = String::new() -> [return: bb3, unwind: bb25]; + _7 = String::new() -> [return: bb3, unwind: bb21]; } bb3: { @@ -52,128 +52,112 @@ StorageLive(_9); + _12 = const false; _9 = move _6; - _8 = std::mem::drop::(move _9) -> [return: bb4, unwind: bb23]; + _8 = std::mem::drop::(move _9) -> [return: bb4, unwind: bb20]; } bb4: { StorageDead(_9); StorageDead(_8); StorageLive(_10); - _10 = String::new() -> [return: bb5, unwind: bb24]; + _10 = String::new() -> [return: bb5, unwind: bb20]; } bb5: { StorageLive(_11); - _11 = String::new() -> [return: bb6, unwind: bb22]; + _11 = String::new() -> [return: bb6, unwind: bb19]; } bb6: { - drop(_7) -> [return: bb7, unwind: bb20]; + drop(_7) -> [return: bb7, unwind: bb17]; } bb7: { StorageDead(_7); - goto -> bb8; ++ _12 = const false; + StorageDead(_6); + drop(_4) -> [return: bb8, unwind: bb15]; } bb8: { -+ _12 = const false; - StorageDead(_6); - drop(_4) -> [return: bb9, unwind: bb16]; + StorageDead(_4); + drop(_2) -> [return: bb9, unwind: bb13]; } bb9: { - StorageDead(_4); - drop(_2) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb10, unwind: bb11]; } bb10: { - drop(_1) -> [return: bb11, unwind: bb12]; + tailcall g_with_arg(move _10, move _11); } - bb11: { - tailcall g_with_arg(move _10, move _11); + bb11 (cleanup): { + drop(_10) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_10) -> [return: bb13, unwind terminate(cleanup)]; + drop(_11) -> [return: bb25, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_11) -> [return: bb29, unwind terminate(cleanup)]; + drop(_10) -> [return: bb14, unwind terminate(cleanup)]; } bb14 (cleanup): { - drop(_10) -> [return: bb15, unwind terminate(cleanup)]; + drop(_11) -> [return: bb24, unwind terminate(cleanup)]; } bb15 (cleanup): { - drop(_11) -> [return: bb28, unwind terminate(cleanup)]; + drop(_10) -> [return: bb16, unwind terminate(cleanup)]; } bb16 (cleanup): { - drop(_10) -> [return: bb17, unwind terminate(cleanup)]; + drop(_11) -> [return: bb23, unwind terminate(cleanup)]; } bb17 (cleanup): { - drop(_11) -> [return: bb27, unwind terminate(cleanup)]; + drop(_10) -> [return: bb18, unwind terminate(cleanup)]; } bb18 (cleanup): { - drop(_10) -> [return: bb19, unwind terminate(cleanup)]; + drop(_11) -> [return: bb21, unwind terminate(cleanup)]; } bb19 (cleanup): { - drop(_11) -> [return: bb26, unwind terminate(cleanup)]; + drop(_10) -> [return: bb20, unwind terminate(cleanup)]; } bb20 (cleanup): { - drop(_10) -> [return: bb21, unwind terminate(cleanup)]; + drop(_7) -> [return: bb21, unwind terminate(cleanup)]; } bb21 (cleanup): { - drop(_11) -> [return: bb25, unwind terminate(cleanup)]; +- drop(_6) -> [return: bb22, unwind terminate(cleanup)]; ++ goto -> bb27; } bb22 (cleanup): { - drop(_10) -> [return: bb24, unwind terminate(cleanup)]; + drop(_4) -> [return: bb23, unwind terminate(cleanup)]; } bb23 (cleanup): { - goto -> bb24; + drop(_2) -> [return: bb24, unwind terminate(cleanup)]; } bb24 (cleanup): { - drop(_7) -> [return: bb25, unwind terminate(cleanup)]; + drop(_1) -> [return: bb25, unwind terminate(cleanup)]; } bb25 (cleanup): { -- drop(_6) -> [return: bb26, unwind terminate(cleanup)]; -+ goto -> bb31; - } - - bb26 (cleanup): { - drop(_4) -> [return: bb27, unwind terminate(cleanup)]; - } - - bb27 (cleanup): { - drop(_2) -> [return: bb28, unwind terminate(cleanup)]; - } - - bb28 (cleanup): { - drop(_1) -> [return: bb29, unwind terminate(cleanup)]; - } - - bb29 (cleanup): { resume; + } + -+ bb30 (cleanup): { -+ drop(_6) -> [return: bb26, unwind terminate(cleanup)]; ++ bb26 (cleanup): { ++ drop(_6) -> [return: bb22, unwind terminate(cleanup)]; + } + -+ bb31 (cleanup): { -+ switchInt(copy _12) -> [0: bb26, otherwise: bb30]; ++ bb27 (cleanup): { ++ switchInt(copy _12) -> [0: bb22, otherwise: bb26]; } } diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff index fc5b71e3d1440..bdb8031557b35 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff @@ -31,20 +31,20 @@ bb0: { + _12 = const false; StorageLive(_4); - _4 = String::new() -> [return: bb1, unwind: bb27]; + _4 = String::new() -> [return: bb1, unwind: bb23]; } bb1: { StorageLive(_5); _5 = const 12_i32; StorageLive(_6); - _6 = String::new() -> [return: bb2, unwind: bb26]; + _6 = String::new() -> [return: bb2, unwind: bb22]; } bb2: { + _12 = const true; StorageLive(_7); - _7 = String::new() -> [return: bb3, unwind: bb25]; + _7 = String::new() -> [return: bb3, unwind: bb21]; } bb3: { @@ -52,128 +52,112 @@ StorageLive(_9); + _12 = const false; _9 = move _6; - _8 = std::mem::drop::(move _9) -> [return: bb4, unwind: bb23]; + _8 = std::mem::drop::(move _9) -> [return: bb4, unwind: bb20]; } bb4: { StorageDead(_9); StorageDead(_8); StorageLive(_10); - _10 = String::new() -> [return: bb5, unwind: bb24]; + _10 = String::new() -> [return: bb5, unwind: bb20]; } bb5: { StorageLive(_11); - _11 = String::new() -> [return: bb6, unwind: bb22]; + _11 = String::new() -> [return: bb6, unwind: bb19]; } bb6: { - drop(_7) -> [return: bb7, unwind: bb20]; + drop(_7) -> [return: bb7, unwind: bb17]; } bb7: { StorageDead(_7); - goto -> bb8; ++ _12 = const false; + StorageDead(_6); + drop(_4) -> [return: bb8, unwind: bb15]; } bb8: { -+ _12 = const false; - StorageDead(_6); - drop(_4) -> [return: bb9, unwind: bb16]; + StorageDead(_4); + drop(_2) -> [return: bb9, unwind: bb13]; } bb9: { - StorageDead(_4); - drop(_2) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb10, unwind: bb11]; } bb10: { - drop(_1) -> [return: bb11, unwind: bb12]; + tailcall g_with_arg(move _10, move _11); } - bb11: { - tailcall g_with_arg(move _10, move _11); + bb11 (cleanup): { + drop(_10) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_10) -> [return: bb13, unwind terminate(cleanup)]; + drop(_11) -> [return: bb25, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_11) -> [return: bb29, unwind terminate(cleanup)]; + drop(_10) -> [return: bb14, unwind terminate(cleanup)]; } bb14 (cleanup): { - drop(_10) -> [return: bb15, unwind terminate(cleanup)]; + drop(_11) -> [return: bb24, unwind terminate(cleanup)]; } bb15 (cleanup): { - drop(_11) -> [return: bb28, unwind terminate(cleanup)]; + drop(_10) -> [return: bb16, unwind terminate(cleanup)]; } bb16 (cleanup): { - drop(_10) -> [return: bb17, unwind terminate(cleanup)]; + drop(_11) -> [return: bb23, unwind terminate(cleanup)]; } bb17 (cleanup): { - drop(_11) -> [return: bb27, unwind terminate(cleanup)]; + drop(_10) -> [return: bb18, unwind terminate(cleanup)]; } bb18 (cleanup): { - drop(_10) -> [return: bb19, unwind terminate(cleanup)]; + drop(_11) -> [return: bb21, unwind terminate(cleanup)]; } bb19 (cleanup): { - drop(_11) -> [return: bb26, unwind terminate(cleanup)]; + drop(_10) -> [return: bb20, unwind terminate(cleanup)]; } bb20 (cleanup): { - drop(_10) -> [return: bb21, unwind terminate(cleanup)]; + drop(_7) -> [return: bb21, unwind terminate(cleanup)]; } bb21 (cleanup): { - drop(_11) -> [return: bb25, unwind terminate(cleanup)]; +- drop(_6) -> [return: bb22, unwind terminate(cleanup)]; ++ goto -> bb27; } bb22 (cleanup): { - drop(_10) -> [return: bb24, unwind terminate(cleanup)]; + drop(_4) -> [return: bb23, unwind terminate(cleanup)]; } bb23 (cleanup): { - goto -> bb24; + drop(_2) -> [return: bb24, unwind terminate(cleanup)]; } bb24 (cleanup): { - drop(_7) -> [return: bb25, unwind terminate(cleanup)]; + drop(_1) -> [return: bb25, unwind terminate(cleanup)]; } bb25 (cleanup): { -- drop(_6) -> [return: bb26, unwind terminate(cleanup)]; -+ goto -> bb31; - } - - bb26 (cleanup): { - drop(_4) -> [return: bb27, unwind terminate(cleanup)]; - } - - bb27 (cleanup): { - drop(_2) -> [return: bb28, unwind terminate(cleanup)]; - } - - bb28 (cleanup): { - drop(_1) -> [return: bb29, unwind terminate(cleanup)]; - } - - bb29 (cleanup): { resume; + } + -+ bb30 (cleanup): { -+ drop(_6) -> [return: bb26, unwind terminate(cleanup)]; ++ bb26 (cleanup): { ++ drop(_6) -> [return: bb22, unwind terminate(cleanup)]; + } + -+ bb31 (cleanup): { -+ switchInt(copy _12) -> [0: bb26, otherwise: bb30]; ++ bb27 (cleanup): { ++ switchInt(copy _12) -> [0: bb22, otherwise: bb26]; } } diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir index 7a9762cf27f77..5dd370a74d9f3 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir @@ -11,6 +11,7 @@ fn method_1(_1: Guard) -> () { let mut _7: isize; let _8: OtherDrop; let _9: (); + let mut _10: bool; scope 1 { debug other_drop => _8; } @@ -19,23 +20,25 @@ fn method_1(_1: Guard) -> () { } bb0: { + _10 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); _6 = &_1; - _5 = ::clone(move _6) -> [return: bb1, unwind: bb13]; + _5 = ::clone(move _6) -> [return: bb1, unwind: bb12]; } bb1: { StorageDead(_6); _4 = &_5; _3 = &(*_4); - _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; + _2 = method_2(move _3) -> [return: bb2, unwind: bb11]; } bb2: { + _10 = const true; StorageDead(_3); PlaceMention(_2); _7 = discriminant(_2); @@ -71,14 +74,15 @@ fn method_1(_1: Guard) -> () { } bb8: { - drop(_5) -> [return: bb9, unwind: bb13]; + drop(_5) -> [return: bb9, unwind: bb12]; } bb9: { StorageDead(_5); StorageDead(_4); + _10 = const false; StorageDead(_2); - drop(_1) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb10, unwind: bb13]; } bb10: { @@ -86,18 +90,14 @@ fn method_1(_1: Guard) -> () { } bb11 (cleanup): { - goto -> bb12; + drop(_5) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_1) -> [return: bb14, unwind terminate(cleanup)]; - } - - bb14 (cleanup): { resume; } } diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir index 7a9762cf27f77..5dd370a74d9f3 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir @@ -11,6 +11,7 @@ fn method_1(_1: Guard) -> () { let mut _7: isize; let _8: OtherDrop; let _9: (); + let mut _10: bool; scope 1 { debug other_drop => _8; } @@ -19,23 +20,25 @@ fn method_1(_1: Guard) -> () { } bb0: { + _10 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); _6 = &_1; - _5 = ::clone(move _6) -> [return: bb1, unwind: bb13]; + _5 = ::clone(move _6) -> [return: bb1, unwind: bb12]; } bb1: { StorageDead(_6); _4 = &_5; _3 = &(*_4); - _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; + _2 = method_2(move _3) -> [return: bb2, unwind: bb11]; } bb2: { + _10 = const true; StorageDead(_3); PlaceMention(_2); _7 = discriminant(_2); @@ -71,14 +74,15 @@ fn method_1(_1: Guard) -> () { } bb8: { - drop(_5) -> [return: bb9, unwind: bb13]; + drop(_5) -> [return: bb9, unwind: bb12]; } bb9: { StorageDead(_5); StorageDead(_4); + _10 = const false; StorageDead(_2); - drop(_1) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb10, unwind: bb13]; } bb10: { @@ -86,18 +90,14 @@ fn method_1(_1: Guard) -> () { } bb11 (cleanup): { - goto -> bb12; + drop(_5) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_1) -> [return: bb14, unwind terminate(cleanup)]; - } - - bb14 (cleanup): { resume; } } diff --git a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr index 2f443797dfa17..ef9714989bbaa 100644 --- a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr +++ b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr @@ -44,15 +44,12 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:33:9 | LL | while let Some(_x) = foo.f() { - | ------- - | | - | first mutable borrow occurs here - | a temporary with access to the first borrow is created here ... + | --- first mutable borrow occurs here LL | foo.g(); | ^^^ second mutable borrow occurs here LL | LL | } - | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option>` + | - first borrow might be used here, when `_x` is dropped and runs the `Drop` code for type `Bar` error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:37:9 diff --git a/tests/ui/consts/const-eval/issue-65394.rs b/tests/ui/consts/const-eval/issue-65394.rs index 2304dbebc7ef2..8df1beff8bb46 100644 --- a/tests/ui/consts/const-eval/issue-65394.rs +++ b/tests/ui/consts/const-eval/issue-65394.rs @@ -1,15 +1,14 @@ //@ revisions: stock precise_drops -//@[precise_drops] check-pass +//@ check-pass -// This test originated from #65394. We conservatively assume that `x` is still `LiveDrop` even +// This test originated from #65394. We conservatively assumed that `x` is still `LiveDrop` even // after it has been moved because a mutable reference to it exists at some point in the const body. // -// With `&mut` in `const` being stable, this surprising behavior is now observable. -// `const_precise_live_drops` fixes that. +// With `&mut` in `const` being stable, this surprising behavior was observable. #![cfg_attr(precise_drops, feature(const_precise_live_drops))] const _: Vec = { - let mut x = Vec::::new(); //[stock]~ ERROR destructor of + let mut x = Vec::::new(); let r = &mut x; let y = x; y diff --git a/tests/ui/consts/const-eval/issue-65394.stock.stderr b/tests/ui/consts/const-eval/issue-65394.stock.stderr deleted file mode 100644 index 514d454df3dc0..0000000000000 --- a/tests/ui/consts/const-eval/issue-65394.stock.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0493]: destructor of `Vec` cannot be evaluated at compile-time - --> $DIR/issue-65394.rs:12:9 - | -LL | let mut x = Vec::::new(); - | ^^^^^ the destructor for this type cannot be evaluated in constants -... -LL | }; - | - value is dropped here - | - = note: see issue #133214 for more information - = help: add `#![feature(const_destruct)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/control-flow/drop-fail.precise.stderr b/tests/ui/consts/control-flow/drop-fail.precise.stderr index 6f07d2329615b..fdded806df997 100644 --- a/tests/ui/consts/control-flow/drop-fail.precise.stderr +++ b/tests/ui/consts/control-flow/drop-fail.precise.stderr @@ -8,7 +8,7 @@ LL | }; | - value is dropped here error[E0493]: destructor of `Option` cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:47:9 + --> $DIR/drop-fail.rs:45:9 | LL | let mut tmp = None; | ^^^^^^^ the destructor for this type cannot be evaluated in constants diff --git a/tests/ui/consts/control-flow/drop-fail.rs b/tests/ui/consts/control-flow/drop-fail.rs index 3593e5af26b00..4b9b5b93ad896 100644 --- a/tests/ui/consts/control-flow/drop-fail.rs +++ b/tests/ui/consts/control-flow/drop-fail.rs @@ -27,8 +27,6 @@ const _: Option = { // existing analysis. const _: NotConstDestruct = { let vec_tuple = (NotConstDestruct,); - //[stock]~^ ERROR destructor of - vec_tuple.0 }; diff --git a/tests/ui/consts/control-flow/drop-fail.stock.stderr b/tests/ui/consts/control-flow/drop-fail.stock.stderr index 3caef5810939c..fe56f1bd2dadb 100644 --- a/tests/ui/consts/control-flow/drop-fail.stock.stderr +++ b/tests/ui/consts/control-flow/drop-fail.stock.stderr @@ -7,17 +7,8 @@ LL | let x = Some(NotConstDestruct); LL | }; | - value is dropped here -error[E0493]: destructor of `(NotConstDestruct,)` cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:29:9 - | -LL | let vec_tuple = (NotConstDestruct,); - | ^^^^^^^^^ the destructor for this type cannot be evaluated in constants -... -LL | }; - | - value is dropped here - error[E0493]: destructor of `Result` cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:37:9 + --> $DIR/drop-fail.rs:35:9 | LL | let x: Result<_, NotConstDestruct> = Ok(NotConstDestruct); | ^ the destructor for this type cannot be evaluated in constants @@ -26,7 +17,7 @@ LL | }; | - value is dropped here error[E0493]: destructor of `Option` cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:47:9 + --> $DIR/drop-fail.rs:45:9 | LL | let mut tmp = None; | ^^^^^^^ the destructor for this type cannot be evaluated in constants @@ -34,6 +25,6 @@ LL | let mut tmp = None; LL | }; | - value is dropped here -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/min_const_fn/min_const_fn.rs b/tests/ui/consts/min_const_fn/min_const_fn.rs index 38ca10858b199..3c31b25afa115 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn.rs @@ -34,19 +34,19 @@ const fn foo35(a: bool, b: bool) -> bool { a ^ b } struct Foo(T); impl Foo { const fn new(t: T) -> Self { Foo(t) } - const fn into_inner(self) -> T { self.0 } //~ ERROR destructor of + const fn into_inner(self) -> T { self.0 } const fn get(&self) -> &T { &self.0 } const fn get_mut(&mut self) -> &mut T { &mut self.0 } } impl<'a, T> Foo { const fn new_lt(t: T) -> Self { Foo(t) } - const fn into_inner_lt(self) -> T { self.0 } //~ ERROR destructor of + const fn into_inner_lt(self) -> T { self.0 } const fn get_lt(&self) -> &T { &self.0 } const fn get_mut_lt(&mut self) -> &mut T { &mut self.0 } } impl Foo { const fn new_s(t: T) -> Self { Foo(t) } - const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructor + const fn into_inner_s(self) -> T { self.0 } const fn get_s(&self) -> &T { &self.0 } const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } } diff --git a/tests/ui/consts/min_const_fn/min_const_fn.stderr b/tests/ui/consts/min_const_fn/min_const_fn.stderr index 0904de2af0d46..ffbe4be554ef2 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn.stderr @@ -1,27 +1,3 @@ -error[E0493]: destructor of `Foo` cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:37:25 - | -LL | const fn into_inner(self) -> T { self.0 } - | ^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constant functions - -error[E0493]: destructor of `Foo` cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:43:28 - | -LL | const fn into_inner_lt(self) -> T { self.0 } - | ^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constant functions - -error[E0493]: destructor of `Foo` cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:49:27 - | -LL | const fn into_inner_s(self) -> T { self.0 } - | ^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constant functions - error: pointers cannot be cast to integers during const eval --> $DIR/min_const_fn.rs:79:42 | @@ -79,6 +55,6 @@ help: consider restricting opaque type `impl std::fmt::Debug` with unstable trai LL | const fn no_apit(_x: impl std::fmt::Debug + [const] Destruct) {} | ++++++++++++++++++ -error: aborting due to 9 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr b/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr deleted file mode 100644 index 6038c6d332fec..0000000000000 --- a/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0493]: destructor of `Option` cannot be evaluated at compile-time - --> $DIR/precise-drop-allow-const-fn-unstable.rs:11:24 - | -LL | pub const fn unwrap(this: Option) -> T { - | ^^^^ the destructor for this type cannot be evaluated in constant functions -... -LL | } - | - value is dropped here - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs index 4bd5f746f5021..c4352c54ad21a 100644 --- a/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs +++ b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs @@ -1,6 +1,6 @@ //@ revisions: allow not_allow //@ compile-flags: --crate-type=lib -Cinstrument-coverage -Zno-profiler-runtime -//@[allow] check-pass +//@ check-pass #![feature(staged_api, rustc_attrs)] #![stable(feature = "rust_test", since = "1.0.0")] @@ -9,7 +9,6 @@ #[rustc_const_stable(feature = "rust_test", since = "1.0.0")] #[cfg_attr(allow, rustc_allow_const_fn_unstable(const_precise_live_drops))] pub const fn unwrap(this: Option) -> T { -//[not_allow]~^ ERROR: cannot be evaluated match this { Some(x) => x, None => panic!(), diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs deleted file mode 100644 index 702cbc88ae4b0..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.rs +++ /dev/null @@ -1,70 +0,0 @@ -//@ dont-require-annotations: NOTE - -#![feature(coroutines, negative_impls, rustc_attrs, stmt_expr_attributes)] - -macro_rules! type_combinations { - ( - $( $name:ident => { $( $tt:tt )* } );* $(;)? - ) => { $( - mod $name { - $( $tt )* - - impl !Sync for Client {} - impl !Send for Client {} - } - - // Struct update syntax. This fails because the Client used in the update is considered - // dropped *after* the yield. - { - let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - //~^ NOTE `significant_drop::Client` which is not `Send` - //~| NOTE `insignificant_dtor::Client` which is not `Send` - //~| NOTE `derived_drop::Client` which is not `Send` - _ => yield, - }; - assert_send(g); - //~^ ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - } - - // Simple owned value. This works because the Client is considered moved into `drop`, - // even though the temporary expression doesn't end until after the yield. - { - let g = #[coroutine] move || match drop($name::Client::default()) { - _ => yield, - }; - assert_send(g); - } - )* } -} - -fn assert_send(_thing: T) {} - -fn main() { - type_combinations!( - // OK - copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; - // NOT OK: MIR borrowck thinks that this is used after the yield, even though - // this has no `Drop` impl and only the drops of the fields are observable. - // FIXME: this should compile. - derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - // NOT OK - significant_drop => { - #[derive(Default)] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - // NOT OK (we need to agree with MIR borrowck) - insignificant_dtor => { - #[derive(Default)] - #[rustc_insignificant_dtor] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - ); -} diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr deleted file mode 100644 index fe8c17c12946d..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ /dev/null @@ -1,128 +0,0 @@ -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:51:46 - | -LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `derived_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:55:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `significant_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` - --> $DIR/drop-tracking-parent-expression.rs:64:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `insignificant_dtor::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/tests/ui/coroutine/parent-expression.rs b/tests/ui/coroutine/parent-expression.rs index 702cbc88ae4b0..e19b035806ec4 100644 --- a/tests/ui/coroutine/parent-expression.rs +++ b/tests/ui/coroutine/parent-expression.rs @@ -19,13 +19,11 @@ macro_rules! type_combinations { let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { //~^ NOTE `significant_drop::Client` which is not `Send` //~| NOTE `insignificant_dtor::Client` which is not `Send` - //~| NOTE `derived_drop::Client` which is not `Send` _ => yield, }; assert_send(g); //~^ ERROR cannot be sent between threads //~| ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads } // Simple owned value. This works because the Client is considered moved into `drop`, diff --git a/tests/ui/coroutine/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr index 0dd97c538a87c..39647809cf4ee 100644 --- a/tests/ui/coroutine/parent-expression.stderr +++ b/tests/ui/coroutine/parent-expression.stderr @@ -1,47 +1,5 @@ error: coroutine cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` - --> $DIR/parent-expression.rs:51:46 - | -LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `derived_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:13 + --> $DIR/parent-expression.rs:24:13 | LL | assert_send(g); | ^^^^^^^^^^^^^^ coroutine is not `Send` @@ -55,12 +13,12 @@ LL | | ); | |_____- in this macro invocation | help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` - --> $DIR/parent-expression.rs:55:13 + --> $DIR/parent-expression.rs:53:13 | LL | pub struct Client; | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 + --> $DIR/parent-expression.rs:22:22 | LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `significant_drop::Client` which is not `Send` @@ -76,14 +34,14 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 + --> $DIR/parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: coroutine cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:13 + --> $DIR/parent-expression.rs:24:13 | LL | assert_send(g); | ^^^^^^^^^^^^^^ coroutine is not `Send` @@ -97,12 +55,12 @@ LL | | ); | |_____- in this macro invocation | help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` - --> $DIR/parent-expression.rs:64:13 + --> $DIR/parent-expression.rs:62:13 | LL | pub struct Client; | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 + --> $DIR/parent-expression.rs:22:22 | LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `insignificant_dtor::Client` which is not `Send` @@ -118,11 +76,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 + --> $DIR/parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/drop/drop-order-comparisons.e2021.fixed b/tests/ui/drop/drop-order-comparisons.e2021.fixed index 77ebff228e2b4..45be91e54c907 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.fixed +++ b/tests/ui/drop/drop-order-comparisons.e2021.fixed @@ -102,8 +102,6 @@ fn t_tailexpr_tuples() { (e.ok(2), e.ok(6).is_ok(), e.ok(3), e.ok(5).is_ok()) //[e2021]~^ WARN relative drop order changing in Rust 2024 //[e2021]~| WARN this changes meaning in Rust 2024 - //[e2021]~| WARN relative drop order changing in Rust 2024 - //[e2021]~| WARN this changes meaning in Rust 2024 }, e.mark(1), e.ok(4)); e.assert(6); } diff --git a/tests/ui/drop/drop-order-comparisons.e2021.stderr b/tests/ui/drop/drop-order-comparisons.e2021.stderr index b1f0967103ab5..1a8e557272434 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.stderr +++ b/tests/ui/drop/drop-order-comparisons.e2021.stderr @@ -27,22 +27,22 @@ LL | | }, e.mark(3), e.ok(4)); | `#1` will be dropped later as of Edition 2024 | note: `#3` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `_v` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,10 +62,12 @@ warning: relative drop order changing in Rust 2024 LL | _ = ({ | _________- LL | | (e.ok(2), e.ok(6).is_ok(), e.ok(3), e.ok(5).is_ok()) - | | ^^^^^^^ - | | | - | | this value will be stored in a temporary; let us call it `#2` - | | up until Edition 2021 `#2` is dropped last but will be dropped earlier in Edition 2024 + | | ------- ^^^^^^^ + | | | | + | | | this value will be stored in a temporary; let us call it `#2` + | | | up until Edition 2021 `#2` is dropped last but will be dropped earlier in Edition 2024 + | | this value will be stored in a temporary; let us call it `#3` + | | up until Edition 2021 `#3` is dropped last but will be dropped earlier in Edition 2024 ... | LL | | }, e.mark(1), e.ok(4)); | | - @@ -75,44 +77,17 @@ LL | | }, e.mark(1), e.ok(4)); | `#1` will be dropped later as of Edition 2024 | note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 - | -LL | impl<'b> Drop for LogDrop<'b> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages - = warning: this changes meaning in Rust 2024 - = note: for more information, see - -warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:102:19 - | -LL | _ = ({ - | _________- -LL | | (e.ok(2), e.ok(6).is_ok(), e.ok(3), e.ok(5).is_ok()) - | | ^^^^^^^ - | | | - | | this value will be stored in a temporary; let us call it `#2` - | | up until Edition 2021 `#2` is dropped last but will be dropped earlier in Edition 2024 -... | -LL | | }, e.mark(1), e.ok(4)); - | | - - | | | - | | now the temporary value is dropped here, before the local variables in the block or statement - | |__________________________this value will be stored in a temporary; let us call it `#1` - | `#1` will be dropped later as of Edition 2024 - | -note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 +note: `#3` invokes this custom destructor + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +96,7 @@ LL | impl<'b> Drop for LogDrop<'b> { = note: for more information, see warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:223:24 + --> $DIR/drop-order-comparisons.rs:221:24 | LL | _ = ({ | _________- @@ -139,12 +114,12 @@ LL | | }, e.mark(2), e.ok(3)); | `#1` will be dropped later as of Edition 2024 | note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -153,7 +128,7 @@ LL | impl<'b> Drop for LogDrop<'b> { = note: for more information, see warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:249:24 + --> $DIR/drop-order-comparisons.rs:247:24 | LL | _ = ({ | _________- @@ -171,12 +146,12 @@ LL | | }, e.mark(2), e.ok(3)); | `#1` will be dropped later as of Edition 2024 | note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +160,7 @@ LL | impl<'b> Drop for LogDrop<'b> { = note: for more information, see warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:125:13 + --> $DIR/drop-order-comparisons.rs:123:13 | LL | _ = (if let Ok(_) = e.ok(4).as_ref() { | ^^^^^^^^^^^^-------^^^^^^^^^ @@ -193,12 +168,12 @@ LL | _ = (if let Ok(_) = e.ok(4).as_ref() { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:129:5 + --> $DIR/drop-order-comparisons.rs:127:5 | LL | }, e.mark(2), e.ok(3)); | ^ @@ -215,7 +190,7 @@ LL ~ } _ => {}}, e.mark(2), e.ok(3)); | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:147:13 + --> $DIR/drop-order-comparisons.rs:145:13 | LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -223,12 +198,12 @@ LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:147:44 + --> $DIR/drop-order-comparisons.rs:145:44 | LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | ^ @@ -244,7 +219,7 @@ LL ~ }}, e.mark(2), e.ok(3)); | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:249:12 + --> $DIR/drop-order-comparisons.rs:247:12 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -252,12 +227,12 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:249:43 + --> $DIR/drop-order-comparisons.rs:247:43 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^ @@ -273,7 +248,7 @@ LL ~ }} | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:320:12 + --> $DIR/drop-order-comparisons.rs:318:12 | LL | if let true = e.err(9).is_ok() {} else { | ^^^^^^^^^^^--------^^^^^^^^ @@ -281,12 +256,12 @@ LL | if let true = e.err(9).is_ok() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:320:41 + --> $DIR/drop-order-comparisons.rs:318:41 | LL | if let true = e.err(9).is_ok() {} else { | ^ @@ -302,7 +277,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:323:12 + --> $DIR/drop-order-comparisons.rs:321:12 | LL | if let Ok(_v) = e.err(8) {} else { | ^^^^^^^^^^^^^-------- @@ -310,12 +285,12 @@ LL | if let Ok(_v) = e.err(8) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:323:35 + --> $DIR/drop-order-comparisons.rs:321:35 | LL | if let Ok(_v) = e.err(8) {} else { | ^ @@ -331,7 +306,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:326:12 + --> $DIR/drop-order-comparisons.rs:324:12 | LL | if let Ok(_) = e.err(7) {} else { | ^^^^^^^^^^^^-------- @@ -339,12 +314,12 @@ LL | if let Ok(_) = e.err(7) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:326:34 + --> $DIR/drop-order-comparisons.rs:324:34 | LL | if let Ok(_) = e.err(7) {} else { | ^ @@ -360,7 +335,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:329:12 + --> $DIR/drop-order-comparisons.rs:327:12 | LL | if let Ok(_) = e.err(6).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -368,12 +343,12 @@ LL | if let Ok(_) = e.err(6).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:329:43 + --> $DIR/drop-order-comparisons.rs:327:43 | LL | if let Ok(_) = e.err(6).as_ref() {} else { | ^ @@ -389,7 +364,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:333:12 + --> $DIR/drop-order-comparisons.rs:331:12 | LL | if let Ok(_v) = e.err(5) {} else { | ^^^^^^^^^^^^^-------- @@ -397,12 +372,12 @@ LL | if let Ok(_v) = e.err(5) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:333:35 + --> $DIR/drop-order-comparisons.rs:331:35 | LL | if let Ok(_v) = e.err(5) {} else { | ^ @@ -418,7 +393,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:336:12 + --> $DIR/drop-order-comparisons.rs:334:12 | LL | if let Ok(_) = e.err(4) {} else { | ^^^^^^^^^^^^-------- @@ -426,12 +401,12 @@ LL | if let Ok(_) = e.err(4) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:336:34 + --> $DIR/drop-order-comparisons.rs:334:34 | LL | if let Ok(_) = e.err(4) {} else { | ^ @@ -447,7 +422,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:372:12 + --> $DIR/drop-order-comparisons.rs:370:12 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -455,12 +430,12 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:503:1 + --> $DIR/drop-order-comparisons.rs:501:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:372:43 + --> $DIR/drop-order-comparisons.rs:370:43 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^ @@ -475,5 +450,5 @@ LL | e.mark(3); LL ~ }}}}}}}}}; | -warning: 15 warnings emitted +warning: 14 warnings emitted diff --git a/tests/ui/drop/drop-order-comparisons.rs b/tests/ui/drop/drop-order-comparisons.rs index 7475c48d8161e..45d41b24fba5b 100644 --- a/tests/ui/drop/drop-order-comparisons.rs +++ b/tests/ui/drop/drop-order-comparisons.rs @@ -102,8 +102,6 @@ fn t_tailexpr_tuples() { (e.ok(2), e.ok(6).is_ok(), e.ok(3), e.ok(5).is_ok()) //[e2021]~^ WARN relative drop order changing in Rust 2024 //[e2021]~| WARN this changes meaning in Rust 2024 - //[e2021]~| WARN relative drop order changing in Rust 2024 - //[e2021]~| WARN this changes meaning in Rust 2024 }, e.mark(1), e.ok(4)); e.assert(6); } diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs index a0f53343d753d..f1e5f68fec916 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs @@ -17,8 +17,6 @@ async fn func() -> Result<(), Drop> { async fn retry_db() -> Result<(), Drop> { loop { match func().await { - //~^ ERROR relative drop order changing in Rust 2024 - //~| WARNING this changes meaning in Rust 2024 Ok(()) => return Ok(()), Err(e) => {} } diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr index a01f41e9b8235..50ac07d8a73a7 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr @@ -1,53 +1,5 @@ error: relative drop order changing in Rust 2024 - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:19:15 - | -LL | match func().await { - | ^^^^^^^----- - | | | - | | this value will be stored in a temporary; let us call it `#4` - | | up until Edition 2021 `#4` is dropped last but will be dropped earlier in Edition 2024 - | | this value will be stored in a temporary; let us call it `#2` - | | `#2` will be dropped later as of Edition 2024 - | this value will be stored in a temporary; let us call it `#3` - | up until Edition 2021 `#3` is dropped last but will be dropped earlier in Edition 2024 - | this value will be stored in a temporary; let us call it `#1` - | `#1` will be dropped later as of Edition 2024 -... -LL | Err(e) => {} - | - - | | - | `e` calls a custom destructor - | `e` will be dropped later as of Edition 2024 -LL | } -LL | } - | - now the temporary value is dropped here, before the local variables in the block or statement - | -note: `#3` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 - | -LL | impl std::ops::Drop for Drop { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: `#2` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 - | -LL | impl std::ops::Drop for Drop { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: `e` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 - | -LL | impl std::ops::Drop for Drop { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages - = warning: this changes meaning in Rust 2024 - = note: for more information, see -note: the lint level is defined here - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9 - | -LL | #![deny(tail_expr_drop_order)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: relative drop order changing in Rust 2024 - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:40:23 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:38:23 | LL | let __awaitee = Drop; | --------- @@ -76,6 +28,11 @@ LL | impl std::ops::Drop for Drop { = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages = warning: this changes meaning in Rust 2024 = note: for more information, see +note: the lint level is defined here + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9 + | +LL | #![deny(tail_expr_drop_order)] + | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/mir/drop-elaboration-after-borrowck-error.rs b/tests/ui/mir/drop-elaboration-after-borrowck-error.rs index cbca3eebf19d1..8a4dba654a4d2 100644 --- a/tests/ui/mir/drop-elaboration-after-borrowck-error.rs +++ b/tests/ui/mir/drop-elaboration-after-borrowck-error.rs @@ -3,7 +3,6 @@ static A: () = { let a: [String; 1]; - //~^ ERROR destructor of a[0] = String::new(); //~^ ERROR destructor of }; diff --git a/tests/ui/mir/drop-elaboration-after-borrowck-error.stderr b/tests/ui/mir/drop-elaboration-after-borrowck-error.stderr index a3b8b97b3ac0c..e48f23375458c 100644 --- a/tests/ui/mir/drop-elaboration-after-borrowck-error.stderr +++ b/tests/ui/mir/drop-elaboration-after-borrowck-error.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `String` cannot be evaluated at compile-time - --> $DIR/drop-elaboration-after-borrowck-error.rs:7:5 + --> $DIR/drop-elaboration-after-borrowck-error.rs:6:5 | LL | a[0] = String::new(); | ^^^^ @@ -11,21 +11,8 @@ LL | a[0] = String::new(); = help: add `#![feature(const_destruct)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0493]: destructor of `[String; 1]` cannot be evaluated at compile-time - --> $DIR/drop-elaboration-after-borrowck-error.rs:5:9 - | -LL | let a: [String; 1]; - | ^ the destructor for this type cannot be evaluated in statics -... -LL | }; - | - value is dropped here - | - = note: see issue #133214 for more information - = help: add `#![feature(const_destruct)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/drop-elaboration-after-borrowck-error.rs:17:9 + --> $DIR/drop-elaboration-after-borrowck-error.rs:16:9 | LL | self.0[0] = other; | ^^^^^^^^^ @@ -34,7 +21,7 @@ LL | self.0[0] = other; | value is dropped here error[E0493]: destructor of `B` cannot be evaluated at compile-time - --> $DIR/drop-elaboration-after-borrowck-error.rs:15:13 + --> $DIR/drop-elaboration-after-borrowck-error.rs:14:13 | LL | let _this = self; | ^^^^^ the destructor for this type cannot be evaluated in constant functions @@ -42,6 +29,6 @@ LL | let _this = self; LL | } | - value is dropped here -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/nll/ice-106874.rs b/tests/ui/nll/ice-106874.rs index 9337eee961bfb..6e8c651e438e5 100644 --- a/tests/ui/nll/ice-106874.rs +++ b/tests/ui/nll/ice-106874.rs @@ -14,8 +14,6 @@ pub fn func(f: F) -> A { //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `Fn` is not general enough //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR higher-ranked subtype error - //~| ERROR higher-ranked subtype error } trait X {} diff --git a/tests/ui/nll/ice-106874.stderr b/tests/ui/nll/ice-106874.stderr index 45dd1557dd027..40728796bdf6d 100644 --- a/tests/ui/nll/ice-106874.stderr +++ b/tests/ui/nll/ice-106874.stderr @@ -25,20 +25,6 @@ help: consider adding an explicit type annotation to the closure's argument LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) | ++++++++ -error: higher-ranked subtype error - --> $DIR/ice-106874.rs:8:5 - | -LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/ice-106874.rs:8:5 - | -LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: implementation of `FnOnce` is not general enough --> $DIR/ice-106874.rs:8:7 | @@ -121,5 +107,5 @@ help: consider adding an explicit type annotation to the closure's argument LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) | ++++++++ -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors diff --git a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs index b0d6e27a3d5ac..a3d1cef8468d8 100644 --- a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs +++ b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs @@ -1,3 +1,5 @@ +//@ check-pass + #![allow(warnings)] struct Wrap<'p> { p: &'p mut i32 } @@ -17,6 +19,5 @@ fn main() { let foo = Foo { a: s, b: wrap }; std::mem::drop(foo.a); std::mem::drop(foo.b); - x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] - // FIXME ^ This currently errors and it should not. + x = 1; } diff --git a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr deleted file mode 100644 index 610a0d6e9cc1e..0000000000000 --- a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:20:5 - | -LL | let wrap = Wrap { p: &mut x }; - | ------ `x` is borrowed here -... -LL | x = 1; - | ^^^^^ `x` is assigned to here but it was already borrowed -LL | // FIXME ^ This currently errors and it should not. -LL | } - | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/suggestions/ufcs-for-deref-inner-clone.stderr b/tests/ui/suggestions/ufcs-for-deref-inner-clone.stderr index 7fde14f1a61bb..95af8599458f4 100644 --- a/tests/ui/suggestions/ufcs-for-deref-inner-clone.stderr +++ b/tests/ui/suggestions/ufcs-for-deref-inner-clone.stderr @@ -2,8 +2,12 @@ error[E0507]: cannot move out of dereference of `MyBox>` --> $DIR/ufcs-for-deref-inner-clone.rs:14:14 | LL | let _x = MyBox(vec![1, 2]).into_iter(); - | ^^^^^^^^^^^^^^^^^ move occurs because value has type `Vec`, which does not implement the `Copy` trait + | ^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call + | | + | move occurs because value has type `Vec`, which does not implement the `Copy` trait | +note: `into_iter` takes ownership of the receiver `self`, which moves value + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | let _x = as Clone>::clone(&MyBox(vec![1, 2])).into_iter();