@@ -23,6 +23,7 @@ macro_rules! impl_nonzero_fmt {
2323 ( #[ $stability: meta] ( $( $Trait: ident ) ,+ ) for $Ty: ident ) => {
2424 $(
2525 #[ $stability]
26+ #[ allow( deprecated) ]
2627 impl fmt:: $Trait for $Ty {
2728 #[ inline]
2829 fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
@@ -34,7 +35,7 @@ macro_rules! impl_nonzero_fmt {
3435}
3536
3637macro_rules! nonzero_integers {
37- ( #[ $stability: meta] $( $Ty: ident( $Int: ty) ; ) + ) => {
38+ ( #[ $stability: meta] # [ $deprecation : meta ] $( $Ty: ident( $Int: ty) ; ) + ) => {
3839 $(
3940 /// An integer that is known not to equal zero.
4041 ///
@@ -46,6 +47,7 @@ macro_rules! nonzero_integers {
4647 /// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
4748 /// ```
4849 #[ $stability]
50+ #[ $deprecation]
4951 #[ allow( deprecated) ]
5052 #[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
5153 pub struct $Ty( NonZero <$Int>) ;
@@ -93,12 +95,26 @@ macro_rules! nonzero_integers {
9395
9496nonzero_integers ! {
9597 #[ unstable( feature = "nonzero" , issue = "49137" ) ]
96- NonZeroU8 ( u8 ) ; NonZeroI8 ( i8 ) ;
97- NonZeroU16 ( u16 ) ; NonZeroI16 ( i16 ) ;
98- NonZeroU32 ( u32 ) ; NonZeroI32 ( i32 ) ;
99- NonZeroU64 ( u64 ) ; NonZeroI64 ( i64 ) ;
100- NonZeroU128 ( u128 ) ; NonZeroI128 ( i128 ) ;
101- NonZeroUsize ( usize ) ; NonZeroIsize ( isize ) ;
98+ #[ allow( deprecated) ] // Redundant, works around "error: inconsistent lockstep iteration"
99+ NonZeroU8 ( u8 ) ;
100+ NonZeroU16 ( u16 ) ;
101+ NonZeroU32 ( u32 ) ;
102+ NonZeroU64 ( u64 ) ;
103+ NonZeroU128 ( u128 ) ;
104+ NonZeroUsize ( usize ) ;
105+ }
106+
107+ nonzero_integers ! {
108+ #[ unstable( feature = "nonzero" , issue = "49137" ) ]
109+ #[ rustc_deprecated( since = "1.26.0" , reason = "\
110+ signed non-zero integers are considered for removal due to lack of known use cases. \
111+ If you’re using them, please comment on https://github.com/rust-lang/rust/issues/49137") ]
112+ NonZeroI8 ( i8 ) ;
113+ NonZeroI16 ( i16 ) ;
114+ NonZeroI32 ( i32 ) ;
115+ NonZeroI64 ( i64 ) ;
116+ NonZeroI128 ( i128 ) ;
117+ NonZeroIsize ( isize ) ;
102118}
103119
104120/// Provides intentionally-wrapped arithmetic on `T`.
0 commit comments