@@ -21,9 +21,9 @@ use ops;
2121use str:: FromStr ;
2222
2323macro_rules! impl_nonzero_fmt {
24- ( # [ $stability : meta ] ( $( $Trait: ident ) ,+ ) for $Ty: ident ) => {
24+ ( ( $( $Trait: ident ) ,+ ) for $Ty: ident ) => {
2525 $(
26- #[ $stability ]
26+ #[ stable ( feature = "nonzero" , since = "1.28.0" ) ]
2727 impl fmt:: $Trait for $Ty {
2828 #[ inline]
2929 fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
@@ -35,7 +35,7 @@ macro_rules! impl_nonzero_fmt {
3535}
3636
3737macro_rules! nonzero_integers {
38- ( # [ $stability : meta ] $( $Ty: ident( $Int: ty) ; ) + ) => {
38+ ( $( $Ty: ident( $Int: ty) ; ) + ) => {
3939 $(
4040 /// An integer that is known not to equal zero.
4141 ///
@@ -46,7 +46,7 @@ macro_rules! nonzero_integers {
4646 /// use std::mem::size_of;
4747 /// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
4848 /// ```
49- #[ $stability ]
49+ #[ stable ( feature = "nonzero" , since = "1.28.0" ) ]
5050 #[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
5151 pub struct $Ty( NonZero <$Int>) ;
5252
@@ -56,14 +56,14 @@ macro_rules! nonzero_integers {
5656 /// # Safety
5757 ///
5858 /// The value must not be zero.
59- #[ $stability ]
59+ #[ stable ( feature = "nonzero" , since = "1.28.0" ) ]
6060 #[ inline]
6161 pub const unsafe fn new_unchecked( n: $Int) -> Self {
6262 $Ty( NonZero ( n) )
6363 }
6464
6565 /// Create a non-zero if the given value is not zero.
66- #[ $stability ]
66+ #[ stable ( feature = "nonzero" , since = "1.28.0" ) ]
6767 #[ inline]
6868 pub fn new( n: $Int) -> Option <Self > {
6969 if n != 0 {
@@ -74,7 +74,7 @@ macro_rules! nonzero_integers {
7474 }
7575
7676 /// Returns the value as a primitive type.
77- #[ $stability ]
77+ #[ stable ( feature = "nonzero" , since = "1.28.0" ) ]
7878 #[ inline]
7979 pub fn get( self ) -> $Int {
8080 self . 0 . 0
@@ -83,15 +83,13 @@ macro_rules! nonzero_integers {
8383 }
8484
8585 impl_nonzero_fmt! {
86- #[ $stability]
8786 ( Debug , Display , Binary , Octal , LowerHex , UpperHex ) for $Ty
8887 }
8988 ) +
9089 }
9190}
9291
9392nonzero_integers ! {
94- #[ unstable( feature = "nonzero" , issue = "49137" ) ]
9593 NonZeroU8 ( u8 ) ;
9694 NonZeroU16 ( u16 ) ;
9795 NonZeroU32 ( u32 ) ;
0 commit comments