about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorJed Davis <jld@panix.com>2013-10-20 11:13:41 -0700
committerJed Davis <jld@panix.com>2013-10-29 09:09:20 -0700
commit472d798dc1c0a7804b54c67b485e134fe097a57e (patch)
tree08b5e84befe41e821f7cdfd9d3a03f591e10c9e6 /src/libstd/num
parentde9bb9738d8fcd95222fc0c9383953881e31d4d5 (diff)
downloadrust-472d798dc1c0a7804b54c67b485e134fe097a57e.tar.gz
rust-472d798dc1c0a7804b54c67b485e134fe097a57e.zip
Work around const_eval issues by changing signed integer `min_value`s.
Otherwise, run-pass/deriving-primitive.rs breaks on 32-bit platforms,
because `int::min_value` is `0xffffffff7fffffff` when evaluated for the
discriminant declaration.
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/int_macros.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index 694e5e7f6bf..ba1a7a4f912 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -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]