File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use crate::mem::ManuallyDrop;
13
13
/// ever gets used to access memory:
14
14
///
15
15
/// ```rust,no_run
16
+ /// # #![allow(invalid_value)]
16
17
/// use std::mem::{self, MaybeUninit};
17
18
///
18
19
/// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior!
@@ -27,6 +28,7 @@ use crate::mem::ManuallyDrop;
27
28
/// always be `true` or `false`. Hence, creating an uninitialized `bool` is undefined behavior:
28
29
///
29
30
/// ```rust,no_run
31
+ /// # #![allow(invalid_value)]
30
32
/// use std::mem::{self, MaybeUninit};
31
33
///
32
34
/// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior!
@@ -40,6 +42,7 @@ use crate::mem::ManuallyDrop;
40
42
/// which otherwise can hold any *fixed* bit pattern:
41
43
///
42
44
/// ```rust,no_run
45
+ /// # #![allow(invalid_value)]
43
46
/// use std::mem::{self, MaybeUninit};
44
47
///
45
48
/// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior!
Original file line number Diff line number Diff line change @@ -445,7 +445,8 @@ pub const fn needs_drop<T>() -> bool {
445
445
///
446
446
/// *Incorrect* usage of this function: initializing a reference with zero.
447
447
///
448
- /// ```no_run
448
+ /// ```rust,no_run
449
+ /// # #![allow(invalid_value)]
449
450
/// use std::mem;
450
451
///
451
452
/// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!
You can’t perform that action at this time.
0 commit comments