We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
NonZero<T>
1 parent ab155bf commit 3e94fe8Copy full SHA for 3e94fe8
1 file changed
core/src/num/nonzero.rs
@@ -111,6 +111,15 @@ impl_zeroable_primitive!(
111
/// ```
112
///
113
/// [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.
123
#[stable(feature = "generic_nonzero", since = "1.79.0")]
124
#[repr(transparent)]
125
#[rustc_nonnull_optimization_guaranteed]
0 commit comments