]> git.lizzy.rs Git - rust.git/commitdiff
Impl int/uint::MIN/MAX in terms of min/max_value
authorSimonas Kazlauskas <git@kazlauskas.me>
Sat, 30 Apr 2016 00:40:34 +0000 (03:40 +0300)
committerSimonas Kazlauskas <git@kazlauskas.me>
Sat, 30 Apr 2016 00:40:34 +0000 (03:40 +0300)
src/libcore/num/int_macros.rs
src/libcore/num/uint_macros.rs

index 42349257ab71c23415eb2edcfb49bbc13c9d6aca..fb1a3bbe3b4fbfeab57972add09e3dd9b260d549 100644 (file)
@@ -10,6 +10,7 @@
 
 #![doc(hidden)]
 
+#[cfg(stage0)]
 macro_rules! int_module { ($T:ty, $bits:expr) => (
 
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
@@ -25,3 +26,15 @@ macro_rules! int_module { ($T:ty, $bits:expr) => (
 pub const MAX: $T = !MIN;
 
 ) }
+
+#[cfg(not(stage0))]
+macro_rules! int_module { ($T:ident, $bits:expr) => (
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(missing_docs)]
+pub const MIN: $T = $T::min_value();
+#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(missing_docs)]
+pub const MAX: $T = $T::max_value();
+
+) }
index 6479836cbe1179361a8c468d100fde73ed91c2d5..af6b1b89f96d571fa9e2971f62e0200f9d5d1d31 100644 (file)
@@ -10,6 +10,7 @@
 
 #![doc(hidden)]
 
+#[cfg(stage0)]
 macro_rules! uint_module { ($T:ty, $bits:expr) => (
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -20,3 +21,15 @@ macro_rules! uint_module { ($T:ty, $bits:expr) => (
 pub const MAX: $T = !0 as $T;
 
 ) }
+
+#[cfg(not(stage0))]
+macro_rules! uint_module { ($T:ident, $bits:expr) => (
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(missing_docs)]
+pub const MIN: $T = $T::min_value();
+#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(missing_docs)]
+pub const MAX: $T = $T::max_value();
+
+) }