Rollup merge of #98888 - RalfJung:interpret-checked-bin, r=oli-obk

interpret: fix CheckedBinOp behavior when overflow checking is disabled

Adjusts the interpreter to https://github.com/rust-lang/rust/pull/98738.

r? `@oli-obk`
This commit is contained in:
Matthias Krüger
2022-07-05 17:08:11 +02:00
committed by GitHub
5 changed files with 26 additions and 4 deletions

View File

@@ -144,6 +144,9 @@ pub trait Machine<'mir, 'tcx>: Sized {
true
}
/// Whether CheckedBinOp MIR statements should actually check for overflow.
fn check_binop_checks_overflow(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
/// Entry point for obtaining the MIR of anything that should get evaluated.
/// So not just functions and shims, but also const/static initializers, anonymous
/// constants, ...
@@ -468,6 +471,11 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
true
}
#[inline(always)]
fn check_binop_checks_overflow(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
true
}
#[inline(always)]
fn call_extra_fn(
_ecx: &mut InterpCx<$mir, $tcx, Self>,