diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-11 16:41:37 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-18 21:35:02 +0000 |
| commit | 7567f1f31d5e968380b1e1c5088b00a0606ea1a0 (patch) | |
| tree | c70fcadf98e8e96e03abebf26254cb93a36c05fa /compiler/rustc_const_eval/src | |
| parent | 1480b1c524cad3a7ee0253496b7b026484e53371 (diff) | |
| download | rust-7567f1f31d5e968380b1e1c5088b00a0606ea1a0.tar.gz rust-7567f1f31d5e968380b1e1c5088b00a0606ea1a0.zip | |
Adapt interpreter.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index da320cd1cd5..919eaca90ce 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -137,8 +137,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } Assert { ref cond, expected, ref msg, target, cleanup } => { + let ignored = !self.tcx.sess.overflow_checks() + && match msg { + mir::AssertKind::OverflowNeg(..) => true, + mir::AssertKind::Overflow(op, ..) => op.is_checkable(), + _ => false, + }; let cond_val = self.read_scalar(&self.eval_operand(cond, None)?)?.to_bool()?; - if expected == cond_val { + if ignored || expected == cond_val { self.go_to_block(target); } else { M::assert_panic(self, msg, cleanup)?; |
