fix lint doc
This commit is contained in:
parent
3d215bdf42
commit
0531ed0b62
1 changed files with 7 additions and 18 deletions
|
@ -2969,32 +2969,21 @@ declare_lint! {
|
|||
/// which causes [undefined behavior].
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # #![allow(unused)]
|
||||
/// unsafe {
|
||||
/// &*core::ptr::null::<i32>()
|
||||
/// };
|
||||
/// ```
|
||||
/// ```rust,no_run
|
||||
/// unsafe {
|
||||
/// core::ptr::addr_of!(*std::ptr::null::<i32>())
|
||||
/// };
|
||||
/// ```
|
||||
/// ```rust,no_run
|
||||
/// unsafe {
|
||||
/// *core::ptr::null::<i32>()
|
||||
/// };
|
||||
/// ```
|
||||
/// ```rust,no_run
|
||||
/// unsafe {
|
||||
/// *(0 as *const i32)
|
||||
/// };
|
||||
/// let x = &*core::ptr::null::<i32>();
|
||||
/// let x = core::ptr::addr_of!(*std::ptr::null::<i32>());
|
||||
/// let x = *core::ptr::null::<i32>();
|
||||
/// let x = *(0 as *const i32);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// {{produces}}
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
///
|
||||
/// Dereferencing a null pointer causes [undefined behavior] even as a place expression,
|
||||
/// like `&*(0 as *const i32)` or `addr_of!(*(0 as *const i32))`.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue