diff options
| author | hyd-dev <yd-huang@outlook.com> | 2021-05-22 19:32:55 +0800 |
|---|---|---|
| committer | hyd-dev <yd-huang@outlook.com> | 2021-05-23 04:24:48 +0800 |
| commit | e743eeb743b4e23ecf3cec67cdcd88f6ce056e79 (patch) | |
| tree | 6bb254249ff84dfb46e3a4c0f113c5662733c613 | |
| parent | 835405199af7230a0349803f90d3ebd80487f23b (diff) | |
| download | rust-e743eeb743b4e23ecf3cec67cdcd88f6ce056e79.tar.gz rust-e743eeb743b4e23ecf3cec67cdcd88f6ce056e79.zip | |
Don't evaluate `self.fn_can_unwind(...)` if `can_unwind` is already true
| -rw-r--r-- | compiler/rustc_mir/src/interpret/terminator.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_mir/src/interpret/terminator.rs b/compiler/rustc_mir/src/interpret/terminator.rs index af5da625cd8..2564ea95e43 100644 --- a/compiler/rustc_mir/src/interpret/terminator.rs +++ b/compiler/rustc_mir/src/interpret/terminator.rs @@ -306,8 +306,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { check_abi(callee_abi)?; } - let callee_can_unwind = - self.fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi); + let can_unwind = can_unwind + && self + .fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi); self.push_stack_frame( instance, @@ -315,7 +316,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ret.map(|p| p.0), StackPopCleanup::Goto { ret: ret.map(|p| p.1), - unwind: if can_unwind && callee_can_unwind { + unwind: if can_unwind { StackPopUnwind::Cleanup(unwind) } else { StackPopUnwind::NotAllowed |
