about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir/src/transform/abort_unwinding_calls.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/compiler/rustc_mir/src/transform/abort_unwinding_calls.rs b/compiler/rustc_mir/src/transform/abort_unwinding_calls.rs
index 44287dbd608..aecb2373eaf 100644
--- a/compiler/rustc_mir/src/transform/abort_unwinding_calls.rs
+++ b/compiler/rustc_mir/src/transform/abort_unwinding_calls.rs
@@ -125,13 +125,13 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
             let abort_bb = body.basic_blocks_mut().push(bb);
 
             for bb in calls_to_terminate {
-                let cleanup = get_cleanup(body.basic_blocks_mut()[bb].terminator_mut());
+                let cleanup = body.basic_blocks_mut()[bb].terminator_mut().unwind_mut().unwrap();
                 *cleanup = Some(abort_bb);
             }
         }
 
         for id in cleanups_to_remove {
-            let cleanup = get_cleanup(body.basic_blocks_mut()[id].terminator_mut());
+            let cleanup = body.basic_blocks_mut()[id].terminator_mut().unwind_mut().unwrap();
             *cleanup = None;
         }
 
@@ -139,14 +139,3 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
         super::simplify::remove_dead_blocks(tcx, body);
     }
 }
-
-fn get_cleanup<'a>(t: &'a mut Terminator<'_>) -> &'a mut Option<BasicBlock> {
-    match &mut t.kind {
-        TerminatorKind::Call { cleanup, .. }
-        | TerminatorKind::Drop { unwind: cleanup, .. }
-        | TerminatorKind::DropAndReplace { unwind: cleanup, .. }
-        | TerminatorKind::Assert { cleanup, .. }
-        | TerminatorKind::FalseUnwind { unwind: cleanup, .. } => cleanup,
-        _ => unreachable!(),
-    }
-}