about summary refs log tree commit diff
path: root/src/libcore/num/mod.rs
diff options
context:
space:
mode:
authorTrevor Spiteri <tspiteri@ieee.org>2020-06-29 10:29:37 +0200
committerTrevor Spiteri <tspiteri@ieee.org>2020-06-29 10:29:37 +0200
commit9739b512a892628534e730ffcd9756b3218c8de8 (patch)
tree8f7c43e8ab961635757a8866cb4c4a0e8648e5f4 /src/libcore/num/mod.rs
parent6dfe144bdd4413ac55cbb2ad2edfb1daa0c4bf15 (diff)
downloadrust-9739b512a892628534e730ffcd9756b3218c8de8.tar.gz
rust-9739b512a892628534e730ffcd9756b3218c8de8.zip
stabilize some const_checked_int_methods
Diffstat (limited to 'src/libcore/num/mod.rs')
-rw-r--r--src/libcore/num/mod.rs39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 72bc13c8b93..4647d7421b1 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -740,9 +740,10 @@ assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_add(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_add(rhs);
@@ -782,9 +783,10 @@ assert_eq!((", stringify!($SelfT), "::MIN + 2).checked_sub(3), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_sub(rhs);
@@ -824,9 +826,10 @@ assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_mul(rhs);
@@ -980,7 +983,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_neg(self) -> Option<Self> {
                 let (a, b) = self.overflowing_neg();
@@ -1002,9 +1006,10 @@ assert_eq!(0x1", stringify!($SelfT), ".checked_shl(129), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
                 let (a, b) = self.overflowing_shl(rhs);
@@ -1026,9 +1031,10 @@ assert_eq!(0x10", stringify!($SelfT), ".checked_shr(128), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
                 let (a, b) = self.overflowing_shr(rhs);
@@ -1051,7 +1057,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);",
 $EndFeature, "
 ```"),
             #[stable(feature = "no_panic_abs", since = "1.13.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_abs(self) -> Option<Self> {
                 if self.is_negative() {
@@ -2976,9 +2983,10 @@ Basic usage:
 assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);", $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_add(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_add(rhs);
@@ -3016,9 +3024,10 @@ Basic usage:
 assert_eq!(0", stringify!($SelfT), ".checked_sub(1), None);", $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_sub(rhs);
@@ -3056,9 +3065,10 @@ Basic usage:
 assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);", $EndFeature, "
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
                 let (a, b) = self.overflowing_mul(rhs);
@@ -3206,7 +3216,8 @@ Basic usage:
 assert_eq!(1", stringify!($SelfT), ".checked_neg(), None);", $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_neg(self) -> Option<Self> {
                 let (a, b) = self.overflowing_neg();
@@ -3227,9 +3238,10 @@ Basic usage:
 assert_eq!(0x10", stringify!($SelfT), ".checked_shl(129), None);", $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
                 let (a, b) = self.overflowing_shl(rhs);
@@ -3250,9 +3262,10 @@ Basic usage:
 assert_eq!(0x10", stringify!($SelfT), ".checked_shr(129), None);", $EndFeature, "
 ```"),
             #[stable(feature = "wrapping", since = "1.7.0")]
-            #[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
+            #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
             #[must_use = "this returns the result of the operation, \
                           without modifying the original"]
+            #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
             #[inline]
             pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
                 let (a, b) = self.overflowing_shr(rhs);