Skip to content

Commit 0147b88

Browse files
committed
use binary_op over overflowing_binary_op
1 parent 80c3f42 commit 0147b88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/data_race.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
553553
let this = self.eval_context_mut();
554554

555555
let old = this.allow_data_races_mut(|this| this.read_immediate(&place.into()))?;
556-
let lt = this.overflowing_binary_op(mir::BinOp::Lt, &old, &rhs)?.0.to_bool()?;
556+
let lt = this.binary_op(mir::BinOp::Lt, &old, &rhs)?.to_scalar()?.to_bool()?;
557557

558558
let new_val = if min {
559559
if lt { &old } else { &rhs }
@@ -593,11 +593,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
593593
// Read as immediate for the sake of `binary_op()`
594594
let old = this.allow_data_races_mut(|this| this.read_immediate(&(place.into())))?;
595595
// `binary_op` will bail if either of them is not a scalar.
596-
let eq = this.overflowing_binary_op(mir::BinOp::Eq, &old, expect_old)?.0;
596+
let eq = this.binary_op(mir::BinOp::Eq, &old, expect_old)?;
597597
// If the operation would succeed, but is "weak", fail some portion
598598
// of the time, based on `rate`.
599599
let rate = this.memory.extra.cmpxchg_weak_failure_rate;
600-
let cmpxchg_success = eq.to_bool()?
600+
let cmpxchg_success = eq.to_scalar()?.to_bool()?
601601
&& (!can_fail_spuriously || this.memory.extra.rng.get_mut().gen::<f64>() < rate);
602602
let res = Immediate::ScalarPair(
603603
old.to_scalar_or_uninit(),

0 commit comments

Comments
 (0)