@@ -23,6 +23,7 @@ macro_rules! impl_nonzero_fmt {
23
23
( #[ $stability: meta] ( $( $Trait: ident ) ,+ ) for $Ty: ident ) => {
24
24
$(
25
25
#[ $stability]
26
+ #[ allow( deprecated) ]
26
27
impl fmt:: $Trait for $Ty {
27
28
#[ inline]
28
29
fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
@@ -34,7 +35,7 @@ macro_rules! impl_nonzero_fmt {
34
35
}
35
36
36
37
macro_rules! nonzero_integers {
37
- ( #[ $stability: meta] $( $Ty: ident( $Int: ty) ; ) + ) => {
38
+ ( #[ $stability: meta] # [ $deprecation : meta ] $( $Ty: ident( $Int: ty) ; ) + ) => {
38
39
$(
39
40
/// An integer that is known not to equal zero.
40
41
///
@@ -46,6 +47,7 @@ macro_rules! nonzero_integers {
46
47
/// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
47
48
/// ```
48
49
#[ $stability]
50
+ #[ $deprecation]
49
51
#[ allow( deprecated) ]
50
52
#[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
51
53
pub struct $Ty( NonZero <$Int>) ;
@@ -93,12 +95,26 @@ macro_rules! nonzero_integers {
93
95
94
96
nonzero_integers ! {
95
97
#[ 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 ) ;
102
118
}
103
119
104
120
/// Provides intentionally-wrapped arithmetic on `T`.
0 commit comments