Skip to content

Commit 3f4145e

Browse files
committed
when terminating during unwinding, show the reason why
1 parent 18658cb commit 3f4145e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/base.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
474474
*destination,
475475
);
476476
}
477-
TerminatorKind::UnwindTerminate => {
478-
codegen_panic_cannot_unwind(fx, source_info);
477+
TerminatorKind::UnwindTerminate(reason) => {
478+
codegen_unwind_terminate(fx, source_info, *reason);
479479
}
480480
TerminatorKind::UnwindResume => {
481481
// FIXME implement unwinding
@@ -971,13 +971,14 @@ pub(crate) fn codegen_panic_nounwind<'tcx>(
971971
codegen_panic_inner(fx, rustc_hir::LangItem::PanicNounwind, &args, source_info.span);
972972
}
973973

974-
pub(crate) fn codegen_panic_cannot_unwind<'tcx>(
974+
pub(crate) fn codegen_unwind_terminate<'tcx>(
975975
fx: &mut FunctionCx<'_, '_, 'tcx>,
976976
source_info: mir::SourceInfo,
977+
reason: UnwindTerminateReason,
977978
) {
978979
let args = [];
979980

980-
codegen_panic_inner(fx, rustc_hir::LangItem::PanicCannotUnwind, &args, source_info.span);
981+
codegen_panic_inner(fx, reason.lang_item(), &args, source_info.span);
981982
}
982983

983984
fn codegen_panic_inner<'tcx>(

src/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
551551
TerminatorKind::Goto { .. }
552552
| TerminatorKind::SwitchInt { .. }
553553
| TerminatorKind::UnwindResume
554-
| TerminatorKind::UnwindTerminate
554+
| TerminatorKind::UnwindTerminate(_)
555555
| TerminatorKind::Return
556556
| TerminatorKind::Unreachable
557557
| TerminatorKind::Drop { .. }

0 commit comments

Comments
 (0)