@@ -6,6 +6,7 @@ use crate::hash::{Hash, Hasher};
66use  crate :: intrinsics; 
77use  crate :: marker:: StructuralPartialEq ; 
88use  crate :: ops:: { BitOr ,  BitOrAssign ,  Div ,  Neg ,  Rem } ; 
9+ use  crate :: panic:: { RefUnwindSafe ,  UnwindSafe } ; 
910use  crate :: ptr; 
1011use  crate :: str:: FromStr ; 
1112
@@ -129,6 +130,25 @@ impl_nonzero_fmt!(Octal);
129130impl_nonzero_fmt ! ( LowerHex ) ; 
130131impl_nonzero_fmt ! ( UpperHex ) ; 
131132
133+ macro_rules!  impl_nonzero_auto_trait { 
134+     ( unsafe  $Trait: ident)  => { 
135+         #[ stable( feature = "nonzero" ,  since = "1.28.0" ) ] 
136+         unsafe  impl <T > $Trait for  NonZero <T > where  T :  ZeroablePrimitive  + $Trait { } 
137+     } ; 
138+     ( $Trait: ident)  => { 
139+         #[ stable( feature = "nonzero" ,  since = "1.28.0" ) ] 
140+         impl <T > $Trait for  NonZero <T > where  T :  ZeroablePrimitive  + $Trait { } 
141+     } ; 
142+ } 
143+ 
144+ // Implement auto-traits manually based on `T` to avoid docs exposing 
145+ // the `ZeroablePrimitive::NonZeroInner` implementation detail. 
146+ impl_nonzero_auto_trait ! ( RefUnwindSafe ) ; 
147+ impl_nonzero_auto_trait ! ( unsafe  Send ) ; 
148+ impl_nonzero_auto_trait ! ( unsafe  Sync ) ; 
149+ impl_nonzero_auto_trait ! ( Unpin ) ; 
150+ impl_nonzero_auto_trait ! ( UnwindSafe ) ; 
151+ 
132152#[ stable( feature = "nonzero" ,  since = "1.28.0" ) ]  
133153impl < T >  Clone  for  NonZero < T > 
134154where 
0 commit comments