Skip to content

Commit 9739b51

Browse files
committed
stabilize some const_checked_int_methods
1 parent 6dfe144 commit 9739b51

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/libcore/num/mod.rs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,10 @@ assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);",
740740
$EndFeature, "
741741
```"),
742742
#[stable(feature = "rust1", since = "1.0.0")]
743-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
743+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
744744
#[must_use = "this returns the result of the operation, \
745745
without modifying the original"]
746+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
746747
#[inline]
747748
pub const fn checked_add(self, rhs: Self) -> Option<Self> {
748749
let (a, b) = self.overflowing_add(rhs);
@@ -782,9 +783,10 @@ assert_eq!((", stringify!($SelfT), "::MIN + 2).checked_sub(3), None);",
782783
$EndFeature, "
783784
```"),
784785
#[stable(feature = "rust1", since = "1.0.0")]
785-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
786+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
786787
#[must_use = "this returns the result of the operation, \
787788
without modifying the original"]
789+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
788790
#[inline]
789791
pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
790792
let (a, b) = self.overflowing_sub(rhs);
@@ -824,9 +826,10 @@ assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);",
824826
$EndFeature, "
825827
```"),
826828
#[stable(feature = "rust1", since = "1.0.0")]
827-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
829+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
828830
#[must_use = "this returns the result of the operation, \
829831
without modifying the original"]
832+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
830833
#[inline]
831834
pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
832835
let (a, b) = self.overflowing_mul(rhs);
@@ -980,7 +983,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);",
980983
$EndFeature, "
981984
```"),
982985
#[stable(feature = "wrapping", since = "1.7.0")]
983-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
986+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
987+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
984988
#[inline]
985989
pub const fn checked_neg(self) -> Option<Self> {
986990
let (a, b) = self.overflowing_neg();
@@ -1002,9 +1006,10 @@ assert_eq!(0x1", stringify!($SelfT), ".checked_shl(129), None);",
10021006
$EndFeature, "
10031007
```"),
10041008
#[stable(feature = "wrapping", since = "1.7.0")]
1005-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
1009+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
10061010
#[must_use = "this returns the result of the operation, \
10071011
without modifying the original"]
1012+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
10081013
#[inline]
10091014
pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
10101015
let (a, b) = self.overflowing_shl(rhs);
@@ -1026,9 +1031,10 @@ assert_eq!(0x10", stringify!($SelfT), ".checked_shr(128), None);",
10261031
$EndFeature, "
10271032
```"),
10281033
#[stable(feature = "wrapping", since = "1.7.0")]
1029-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
1034+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
10301035
#[must_use = "this returns the result of the operation, \
10311036
without modifying the original"]
1037+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
10321038
#[inline]
10331039
pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
10341040
let (a, b) = self.overflowing_shr(rhs);
@@ -1051,7 +1057,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);",
10511057
$EndFeature, "
10521058
```"),
10531059
#[stable(feature = "no_panic_abs", since = "1.13.0")]
1054-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
1060+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
1061+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
10551062
#[inline]
10561063
pub const fn checked_abs(self) -> Option<Self> {
10571064
if self.is_negative() {
@@ -2976,9 +2983,10 @@ Basic usage:
29762983
assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);", $EndFeature, "
29772984
```"),
29782985
#[stable(feature = "rust1", since = "1.0.0")]
2979-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
2986+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
29802987
#[must_use = "this returns the result of the operation, \
29812988
without modifying the original"]
2989+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
29822990
#[inline]
29832991
pub const fn checked_add(self, rhs: Self) -> Option<Self> {
29842992
let (a, b) = self.overflowing_add(rhs);
@@ -3016,9 +3024,10 @@ Basic usage:
30163024
assert_eq!(0", stringify!($SelfT), ".checked_sub(1), None);", $EndFeature, "
30173025
```"),
30183026
#[stable(feature = "rust1", since = "1.0.0")]
3019-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
3027+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
30203028
#[must_use = "this returns the result of the operation, \
30213029
without modifying the original"]
3030+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
30223031
#[inline]
30233032
pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
30243033
let (a, b) = self.overflowing_sub(rhs);
@@ -3056,9 +3065,10 @@ Basic usage:
30563065
assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);", $EndFeature, "
30573066
```"),
30583067
#[stable(feature = "rust1", since = "1.0.0")]
3059-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
3068+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
30603069
#[must_use = "this returns the result of the operation, \
30613070
without modifying the original"]
3071+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
30623072
#[inline]
30633073
pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
30643074
let (a, b) = self.overflowing_mul(rhs);
@@ -3206,7 +3216,8 @@ Basic usage:
32063216
assert_eq!(1", stringify!($SelfT), ".checked_neg(), None);", $EndFeature, "
32073217
```"),
32083218
#[stable(feature = "wrapping", since = "1.7.0")]
3209-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
3219+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
3220+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
32103221
#[inline]
32113222
pub const fn checked_neg(self) -> Option<Self> {
32123223
let (a, b) = self.overflowing_neg();
@@ -3227,9 +3238,10 @@ Basic usage:
32273238
assert_eq!(0x10", stringify!($SelfT), ".checked_shl(129), None);", $EndFeature, "
32283239
```"),
32293240
#[stable(feature = "wrapping", since = "1.7.0")]
3230-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
3241+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
32313242
#[must_use = "this returns the result of the operation, \
32323243
without modifying the original"]
3244+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
32333245
#[inline]
32343246
pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
32353247
let (a, b) = self.overflowing_shl(rhs);
@@ -3250,9 +3262,10 @@ Basic usage:
32503262
assert_eq!(0x10", stringify!($SelfT), ".checked_shr(129), None);", $EndFeature, "
32513263
```"),
32523264
#[stable(feature = "wrapping", since = "1.7.0")]
3253-
#[rustc_const_unstable(feature = "const_checked_int_methods", issue = "53718")]
3265+
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.46.0")]
32543266
#[must_use = "this returns the result of the operation, \
32553267
without modifying the original"]
3268+
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
32563269
#[inline]
32573270
pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
32583271
let (a, b) = self.overflowing_shr(rhs);

0 commit comments

Comments
 (0)