diff options
| author | AliƩnore Bouttefeux <alienore.bouttefeux@gmail.com> | 2021-04-08 12:09:32 +0200 |
|---|---|---|
| committer | AliƩnore Bouttefeux <alienore.bouttefeux@gmail.com> | 2021-04-08 12:09:32 +0200 |
| commit | 0531ed0b6220257d7c79405ca7d81d9fe66976be (patch) | |
| tree | cfb835db4b6d0aecbce1449436d88db1526bdf82 | |
| parent | 3d215bdf42514311e48f5dc1cbf71cbd3d74e732 (diff) | |
| download | rust-0531ed0b6220257d7c79405ca7d81d9fe66976be.tar.gz rust-0531ed0b6220257d7c79405ca7d81d9fe66976be.zip | |
fix lint doc
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index e449cd8c755..905a808f51f 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -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))`. /// |
