Skip to content

Commit 472d798

Browse files
committed
Work around const_eval issues by changing signed integer min_values.
Otherwise, run-pass/deriving-primitive.rs breaks on 32-bit platforms, because `int::min_value` is `0xffffffff7fffffff` when evaluated for the discriminant declaration.
1 parent de9bb97 commit 472d798

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libstd/num/int_macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ pub static bits : uint = $bits;
2929
pub static bytes : uint = ($bits / 8);
3030

3131
pub static min_value: $T = (-1 as $T) << (bits - 1);
32-
pub static max_value: $T = min_value - 1 as $T;
32+
// FIXME(#9837): Compute min_value like this so the high bits that shouldn't exist are 0.
33+
pub static max_value: $T = !min_value;
3334

3435
impl CheckedDiv for $T {
3536
#[inline]

0 commit comments

Comments
 (0)