From c1c674c2dbfe3f6dc47d11368c1b5ee4ab008799 Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Mon, 29 Jun 2020 10:36:18 +0200 Subject: [PATCH] stabilize const_saturating_int_methods --- src/libcore/lib.rs | 1 - src/libcore/num/mod.rs | 19 +++++++++++-------- src/test/ui/consts/const-int-arithmetic.rs | 1 - .../ui/consts/const-int-saturating-arith.rs | 1 - 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index aeb52bffbf24..a156edd51605 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -78,7 +78,6 @@ #![feature(const_checked_int_methods)] #![feature(const_euclidean_int_methods)] #![feature(const_overflowing_int_methods)] -#![feature(const_saturating_int_methods)] #![feature(const_int_unchecked_arith)] #![feature(const_int_pow)] #![feature(constctlz)] diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 4647d7421b1d..c4d574c5bc59 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1129,7 +1129,7 @@ $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1155,7 +1155,7 @@ assert_eq!(", stringify!($SelfT), "::MAX.saturating_sub(-1), ", stringify!($Self $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1183,7 +1183,7 @@ $EndFeature, " ```"), #[stable(feature = "saturating_neg", since = "1.45.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] #[inline] pub const fn saturating_neg(self) -> Self { intrinsics::saturating_sub(0, self) @@ -1209,7 +1209,8 @@ $EndFeature, " ```"), #[stable(feature = "saturating_neg", since = "1.45.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] + #[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))] #[inline] pub const fn saturating_abs(self) -> Self { if self.is_negative() { @@ -1236,9 +1237,10 @@ assert_eq!(", stringify!($SelfT), "::MIN.saturating_mul(10), ", stringify!($Self $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_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 saturating_mul(self, rhs: Self) -> Self { match self.checked_mul(rhs) { @@ -3330,7 +3332,7 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] #[inline] pub const fn saturating_add(self, rhs: Self) -> Self { intrinsics::saturating_add(self, rhs) @@ -3352,7 +3354,7 @@ assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.46.0")] #[inline] pub const fn saturating_sub(self, rhs: Self) -> Self { intrinsics::saturating_sub(self, rhs) @@ -3374,9 +3376,10 @@ assert_eq!((", stringify!($SelfT), "::MAX).saturating_mul(10), ", stringify!($Se "::MAX);", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_saturating_int_methods", issue = "53718")] + #[rustc_const_stable(feature = "const_saturating_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 saturating_mul(self, rhs: Self) -> Self { match self.checked_mul(rhs) { diff --git a/src/test/ui/consts/const-int-arithmetic.rs b/src/test/ui/consts/const-int-arithmetic.rs index 9c94551f7440..9b2e30961aae 100644 --- a/src/test/ui/consts/const-int-arithmetic.rs +++ b/src/test/ui/consts/const-int-arithmetic.rs @@ -3,7 +3,6 @@ #![feature(const_checked_int_methods)] #![feature(const_euclidean_int_methods)] #![feature(const_overflowing_int_methods)] -#![feature(const_saturating_int_methods)] #![feature(const_wrapping_int_methods)] use std::{i8, i128}; diff --git a/src/test/ui/consts/const-int-saturating-arith.rs b/src/test/ui/consts/const-int-saturating-arith.rs index 4718120a51bd..7edbdd4cec5a 100644 --- a/src/test/ui/consts/const-int-saturating-arith.rs +++ b/src/test/ui/consts/const-int-saturating-arith.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(const_saturating_int_methods)] const INT_U32_NO: u32 = (42 as u32).saturating_add(2); const INT_U32: u32 = u32::MAX.saturating_add(1);