Skip to content

Commit 3d215bd

Browse files
committed
change documentation of lint
1 parent c7bc41f commit 3d215bd

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

compiler/rustc_lint/src/builtin.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,16 +2969,25 @@ declare_lint! {
29692969
/// which causes [undefined behavior].
29702970
///
29712971
/// ### Example
2972-
///
29732972
/// ```rust,no_run
2974-
/// let x: i32 = unsafe {
2975-
/// *ptr::null()
2973+
/// unsafe {
2974+
/// &*core::ptr::null::<i32>()
29762975
/// };
29772976
/// ```
29782977
/// ```rust,no_run
29792978
/// unsafe {
2980-
/// *(0 as *const i32);
2981-
/// }
2979+
/// core::ptr::addr_of!(*std::ptr::null::<i32>())
2980+
/// };
2981+
/// ```
2982+
/// ```rust,no_run
2983+
/// unsafe {
2984+
/// *core::ptr::null::<i32>()
2985+
/// };
2986+
/// ```
2987+
/// ```rust,no_run
2988+
/// unsafe {
2989+
/// *(0 as *const i32)
2990+
/// };
29822991
/// ```
29832992
///
29842993
/// {{produces}}

0 commit comments

Comments
 (0)