]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/interpret/intrinsics.rs
Auto merge of #69586 - petrochenkov:unmerge, r=Centril
[rust.git] / src / librustc_mir / interpret / intrinsics.rs
index cd06cf01bfa8111a1537fb2acd6da72820cbbe21..891afbf437f2be000de5f7d6908a46de93af395f 100644 (file)
@@ -203,7 +203,7 @@ pub fn emulate_intrinsic(
                         if is_add {
                             // max unsigned
                             Scalar::from_uint(
-                                u128::max_value() >> (128 - num_bits),
+                                u128::MAX >> (128 - num_bits),
                                 Size::from_bits(num_bits),
                             )
                         } else {
@@ -381,11 +381,11 @@ pub fn exact_div(
         dest: PlaceTy<'tcx, M::PointerTag>,
     ) -> InterpResult<'tcx> {
         // Performs an exact division, resulting in undefined behavior where
-        // `x % y != 0` or `y == 0` or `x == T::min_value() && y == -1`.
+        // `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`.
         // First, check x % y != 0 (or if that computation overflows).
         let (res, overflow, _ty) = self.overflowing_binary_op(BinOp::Rem, a, b)?;
-        if overflow || res.to_bits(a.layout.size)? != 0 {
-            // Then, check if `b` is -1, which is the "min_value / -1" case.
+        if overflow || res.assert_bits(a.layout.size) != 0 {
+            // Then, check if `b` is -1, which is the "MIN / -1" case.
             let minus1 = Scalar::from_int(-1, dest.layout.size);
             let b_scalar = b.to_scalar().unwrap();
             if b_scalar == minus1 {