File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ impl_zeroable_primitive!(
111111/// ```
112112///
113113/// [null pointer optimization]: crate::option#representation
114+ ///
115+ /// # Note on generic usage
116+ ///
117+ /// `NonZero<T>` can only be used with some standard library primitive types
118+ /// (such as `u8`, `i32`, and etc.). The type parameter `T` must implement the
119+ /// internal trait [`ZeroablePrimitive`], which is currently permanently unstable
120+ /// and cannot be implemented by users. Therefore, you cannot use `NonZero<T>`
121+ /// with your own types, nor can you implement traits for all `NonZero<T>`,
122+ /// only for concrete types.
114123#[ stable( feature = "generic_nonzero" , since = "1.79.0" ) ]
115124#[ repr( transparent) ]
116125#[ rustc_nonnull_optimization_guaranteed]
You can’t perform that action at this time.
0 commit comments