We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b0b07d commit 6aaa832Copy full SHA for 6aaa832
library/core/src/ptr/non_null.rs
@@ -173,8 +173,14 @@ impl<T: ?Sized> NonNull<T> {
173
///
174
/// let mut x = 0u32;
175
/// let ptr = unsafe { NonNull::new_unchecked(&mut x as *mut _) };
176
+ /// ```
177
+ ///
178
+ /// *Incorrect* usage of this function:
179
180
+ /// ```rust,no_run
181
+ /// use std::ptr::NonNull;
182
- /// // NEVER DO THAT!!!
183
+ /// // NEVER DO THAT!!! This is undefined behavior. ⚠️
184
/// let ptr = unsafe { NonNull::<u32>::new_unchecked(std::ptr::null_mut()) };
185
/// ```
186
#[stable(feature = "nonnull", since = "1.25.0")]
0 commit comments