mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Rollup merge of #87653 - RalfJung:dont-run-ub, r=kennytm
mark a UB doctest as no_run See https://github.com/rust-lang/rust/pull/87547#discussion_r680334117 Cc `@GuillaumeGomez` `@kennytm`
This commit is contained in:
commit
0851841970
@ -173,8 +173,14 @@ impl<T: ?Sized> NonNull<T> {
|
||||
///
|
||||
/// let mut x = 0u32;
|
||||
/// let ptr = unsafe { NonNull::new_unchecked(&mut x as *mut _) };
|
||||
/// ```
|
||||
///
|
||||
/// // NEVER DO THAT!!!
|
||||
/// *Incorrect* usage of this function:
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use std::ptr::NonNull;
|
||||
///
|
||||
/// // NEVER DO THAT!!! This is undefined behavior. ⚠️
|
||||
/// let ptr = unsafe { NonNull::<u32>::new_unchecked(std::ptr::null_mut()) };
|
||||
/// ```
|
||||
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||
|
Loading…
Reference in New Issue
Block a user