Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e743eeb

Browse files
author
hyd-dev
committed
Don't evaluate self.fn_can_unwind(...) if can_unwind is already true
1 parent 8354051 commit e743eeb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/rustc_mir/src/interpret/terminator.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
306306
check_abi(callee_abi)?;
307307
}
308308

309-
let callee_can_unwind =
310-
self.fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi);
309+
let can_unwind = can_unwind
310+
&& self
311+
.fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi);
311312

312313
self.push_stack_frame(
313314
instance,
314315
body,
315316
ret.map(|p| p.0),
316317
StackPopCleanup::Goto {
317318
ret: ret.map(|p| p.1),
318-
unwind: if can_unwind && callee_can_unwind {
319+
unwind: if can_unwind {
319320
StackPopUnwind::Cleanup(unwind)
320321
} else {
321322
StackPopUnwind::NotAllowed

0 commit comments

Comments
 (0)