diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index 48fa856839602..dcbf6a52ba9f5 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -139,8 +139,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // the fact that the operation has overflowed (if either is 0 no // overflow can occur) let first_term: u128 = l.to_scalar()?.to_bits(l.layout.size)?; - let first_term_pos = first_term & (1 << (num_bits-1)) == 0; - if first_term_pos { + let first_term_positive = first_term & (1 << (num_bits-1)) == 0; + if first_term_positive { // Negative overflow not possible since the positive first term // can only increase an (in range) negative term for addition // or corresponding negated positive term for subtraction diff --git a/src/test/run-pass/const-int-saturating-arith.rs b/src/test/run-pass/const-int-saturating-arith.rs index 4f586a276f0d2..dae4c7216b2c0 100644 --- a/src/test/run-pass/const-int-saturating-arith.rs +++ b/src/test/run-pass/const-int-saturating-arith.rs @@ -1,3 +1,4 @@ +// ignore-emscripten no i128 support #![feature(const_saturating_int_methods)] const INT_U32_NO: u32 = (42 as u32).saturating_add(2);