Skip to content

Commit

Permalink
Work around const_eval issues by changing signed integer min_values.
Browse files Browse the repository at this point in the history
Otherwise, run-pass/deriving-primitive.rs breaks on 32-bit platforms,
because `int::min_value` is `0xffffffff7fffffff` when evaluated for the
discriminant declaration.
  • Loading branch information
jld committed Oct 29, 2013
1 parent de9bb97 commit 472d798
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libstd/num/int_macros.rs
Expand Up @@ -29,7 +29,8 @@ pub static bits : uint = $bits;
pub static bytes : uint = ($bits / 8);

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

impl CheckedDiv for $T {
#[inline]
Expand Down

0 comments on commit 472d798

Please sign in to comment.