From 1499a6faad8a64c87e4837572cbcea959ec5c006 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Thu, 6 Apr 2023 22:19:22 +0100 Subject: [PATCH] UnwindAction::Terminate edge is also critical edge --- compiler/rustc_mir_transform/src/add_call_guards.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_mir_transform/src/add_call_guards.rs b/compiler/rustc_mir_transform/src/add_call_guards.rs index ea7ccb512e0..e1e354efa1c 100644 --- a/compiler/rustc_mir_transform/src/add_call_guards.rs +++ b/compiler/rustc_mir_transform/src/add_call_guards.rs @@ -53,7 +53,8 @@ pub fn add_call_guards(&self, body: &mut Body<'_>) { kind: TerminatorKind::Call { target: Some(ref mut destination), unwind, .. }, source_info, }) if pred_count[*destination] > 1 - && (matches!(unwind, UnwindAction::Cleanup(_)) || self == &AllCallEdges) => + && (matches!(unwind, UnwindAction::Cleanup(_) | UnwindAction::Terminate) + || self == &AllCallEdges) => { // It's a critical edge, break it let call_guard = BasicBlockData {