Skip to content

Commit c4f2d21

Browse files
committed
Mark the panic_no_unwind lang item as nounwind
1 parent 24ae996 commit c4f2d21

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_typeck/src/collect.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,13 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
27782778
}
27792779
}
27802780

2781+
// The panic_no_unwind function called by TerminatorKind::Abort will never
2782+
// unwind. If the panic handler that it invokes unwind then it will simply
2783+
// call the panic handler again.
2784+
if Some(id) == tcx.lang_items().panic_no_unwind() {
2785+
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND;
2786+
}
2787+
27812788
let supported_target_features = tcx.supported_target_features(LOCAL_CRATE);
27822789

27832790
let mut inline_span = None;

0 commit comments

Comments
 (0)