Rollup merge of #84251 - RalfJung:non-zero-const-since, r=kennytm
fix 'const-stable since' for NonZeroU*::new_unchecked For the unsigned `NonZero` types, `new_unchecked` was const-stable from the start with https://github.com/rust-lang/rust/pull/50808. Fix the docs to accurately reflect that. I think this `since` is also incorrect: ```rust #[stable(feature = "from_nonzero", since = "1.31.0")] impl From<$Ty> for $Int { ``` The signed nonzero types were only stabilized in 1.34, so that `From` impl certainly didn't exist before. But I had enough of digging through git histories after I figured out when `new_unchecked` became const-stable...^^
This commit is contained in:
commit
47886ead1f
1 changed files with 14 additions and 14 deletions
|
@ -23,7 +23,7 @@ macro_rules! impl_nonzero_fmt {
|
|||
}
|
||||
|
||||
macro_rules! nonzero_integers {
|
||||
( $( #[$stability: meta] $Ty: ident($Int: ty); )+ ) => {
|
||||
( $( #[$stability: meta] #[$const_new_unchecked_stability: meta] $Ty: ident($Int: ty); )+ ) => {
|
||||
$(
|
||||
/// An integer that is known not to equal zero.
|
||||
///
|
||||
|
@ -48,7 +48,7 @@ macro_rules! nonzero_integers {
|
|||
///
|
||||
/// The value must not be zero.
|
||||
#[$stability]
|
||||
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
|
||||
#[$const_new_unchecked_stability]
|
||||
#[inline]
|
||||
pub const unsafe fn new_unchecked(n: $Int) -> Self {
|
||||
// SAFETY: this is guaranteed to be safe by the caller.
|
||||
|
@ -146,18 +146,18 @@ macro_rules! nonzero_integers {
|
|||
}
|
||||
|
||||
nonzero_integers! {
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
|
||||
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
|
||||
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
|
||||
}
|
||||
|
||||
macro_rules! from_str_radix_nzint_impl {
|
||||
|
|
Loading…
Add table
Reference in a new issue