Rename checked_binop_checks_overflow.

This commit is contained in:
Camille GILLOT 2023-02-12 15:31:34 +00:00
parent a5769193d1
commit c1a0f8205c
3 changed files with 8 additions and 7 deletions

View file

@ -147,8 +147,9 @@ pub trait Machine<'mir, 'tcx>: Sized {
true true
} }
/// Whether CheckedBinOp MIR statements should actually check for overflow. /// Whether Assert(OverflowNeg) and Assert(Overflow) MIR terminators should actually
fn checked_binop_checks_overflow(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool; /// check for overflow.
fn ignore_checkable_overflow_assertions(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
/// Entry point for obtaining the MIR of anything that should get evaluated. /// Entry point for obtaining the MIR of anything that should get evaluated.
/// So not just functions and shims, but also const/static initializers, anonymous /// So not just functions and shims, but also const/static initializers, anonymous
@ -466,8 +467,8 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
} }
#[inline(always)] #[inline(always)]
fn checked_binop_checks_overflow(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool { fn ignore_checkable_overflow_assertions(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
true false
} }
#[inline(always)] #[inline(always)]

View file

@ -137,7 +137,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
} }
Assert { ref cond, expected, ref msg, target, cleanup } => { Assert { ref cond, expected, ref msg, target, cleanup } => {
let ignored = !M::checked_binop_checks_overflow(self) let ignored = M::ignore_checkable_overflow_assertions(self)
&& match msg { && match msg {
mir::AssertKind::OverflowNeg(..) => true, mir::AssertKind::OverflowNeg(..) => true,
mir::AssertKind::Overflow(op, ..) => op.is_checkable(), mir::AssertKind::Overflow(op, ..) => op.is_checkable(),

View file

@ -815,8 +815,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
} }
#[inline(always)] #[inline(always)]
fn checked_binop_checks_overflow(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool { fn ignore_checkable_overflow_assertions(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
ecx.tcx.sess.overflow_checks() !ecx.tcx.sess.overflow_checks()
} }
#[inline(always)] #[inline(always)]