Rollup merge of #97908 - iago-lito:stabilize_nonzero_checked_ops_constness, r=scottmcm

Stabilize NonZero* checked operations constness.

Partial stabilization for #97547 (continued).
This commit is contained in:
Matthias Krüger 2022-06-26 19:47:02 +02:00 committed by GitHub
commit e8a2e265b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,7 +316,6 @@ impl $Ty {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -331,7 +330,8 @@ impl $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -351,7 +351,6 @@ pub const fn checked_add(self, other: $Int) -> Option<$Ty> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -366,7 +365,8 @@ pub const fn checked_add(self, other: $Int) -> Option<$Ty> {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -415,7 +415,6 @@ pub const fn saturating_add(self, other: $Int) -> $Ty {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -432,7 +431,8 @@ pub const fn saturating_add(self, other: $Int) -> $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -521,7 +521,6 @@ impl $Ty {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -534,7 +533,8 @@ impl $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -551,7 +551,6 @@ pub const fn abs(self) -> $Ty {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -566,7 +565,8 @@ pub const fn abs(self) -> $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -586,7 +586,6 @@ pub const fn checked_abs(self) -> Option<$Ty> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -602,7 +601,8 @@ pub const fn checked_abs(self) -> Option<$Ty> {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -621,7 +621,6 @@ pub const fn overflowing_abs(self) -> ($Ty, bool) {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -642,7 +641,8 @@ pub const fn overflowing_abs(self) -> ($Ty, bool) {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -657,7 +657,6 @@ pub const fn saturating_abs(self) -> $Ty {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -677,7 +676,8 @@ pub const fn saturating_abs(self) -> $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -692,7 +692,6 @@ pub const fn wrapping_abs(self) -> $Ty {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
#[doc = concat!("# use std::num::", stringify!($Uty), ";")] #[doc = concat!("# use std::num::", stringify!($Uty), ";")]
/// ///
@ -712,7 +711,8 @@ pub const fn wrapping_abs(self) -> $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -746,7 +746,6 @@ impl $Ty {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -761,7 +760,8 @@ impl $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -782,7 +782,6 @@ pub const fn checked_mul(self, other: $Ty) -> Option<$Ty> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -797,7 +796,8 @@ pub const fn checked_mul(self, other: $Ty) -> Option<$Ty> {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -855,7 +855,6 @@ pub const fn saturating_mul(self, other: $Ty) -> $Ty {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -870,7 +869,8 @@ pub const fn saturating_mul(self, other: $Ty) -> $Ty {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]
@ -899,7 +899,6 @@ pub const fn checked_pow(self, other: u32) -> Option<$Ty> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(nonzero_ops)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// ///
/// # fn main() { test().unwrap(); } /// # fn main() { test().unwrap(); }
@ -914,7 +913,8 @@ pub const fn checked_pow(self, other: u32) -> Option<$Ty> {
/// # Some(()) /// # Some(())
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "nonzero_ops", issue = "84186")] #[stable(feature = "nonzero_checked_ops", since = "1.64.0")]
#[rustc_const_stable(feature = "const_nonzero_checked_ops", since = "1.64.0")]
#[must_use = "this returns the result of the operation, \ #[must_use = "this returns the result of the operation, \
without modifying the original"] without modifying the original"]
#[inline] #[inline]