Skip to content

Commit f013c07

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#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...^^
2 parents e81bcc0 + 9aa6c1e commit f013c07

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

library/core/src/num/nonzero.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macro_rules! impl_nonzero_fmt {
2323
}
2424

2525
macro_rules! nonzero_integers {
26-
( $( #[$stability: meta] $Ty: ident($Int: ty); )+ ) => {
26+
( $( #[$stability: meta] #[$const_new_unchecked_stability: meta] $Ty: ident($Int: ty); )+ ) => {
2727
$(
2828
/// An integer that is known not to equal zero.
2929
///
@@ -48,7 +48,7 @@ macro_rules! nonzero_integers {
4848
///
4949
/// The value must not be zero.
5050
#[$stability]
51-
#[rustc_const_stable(feature = "nonzero", since = "1.34.0")]
51+
#[$const_new_unchecked_stability]
5252
#[inline]
5353
pub const unsafe fn new_unchecked(n: $Int) -> Self {
5454
// SAFETY: this is guaranteed to be safe by the caller.
@@ -146,18 +146,18 @@ macro_rules! nonzero_integers {
146146
}
147147

148148
nonzero_integers! {
149-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
150-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
151-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
152-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
153-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
154-
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
155-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
156-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
157-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
158-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
159-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
160-
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
149+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
150+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
151+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
152+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
153+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
154+
#[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
155+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
156+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
157+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
158+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
159+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
160+
#[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
161161
}
162162

163163
macro_rules! from_str_radix_nzint_impl {

0 commit comments

Comments
 (0)