File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 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;
1313/// ever gets used to access memory:
1414///
1515/// ```rust,no_run
16+ /// # #![allow(invalid_value)]
1617/// use std::mem::{self, MaybeUninit};
1718///
1819/// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior!
@@ -27,6 +28,7 @@ use crate::mem::ManuallyDrop;
2728/// always be `true` or `false`. Hence, creating an uninitialized `bool` is undefined behavior:
2829///
2930/// ```rust,no_run
31+ /// # #![allow(invalid_value)]
3032/// use std::mem::{self, MaybeUninit};
3133///
3234/// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior!
@@ -40,6 +42,7 @@ use crate::mem::ManuallyDrop;
4042/// which otherwise can hold any *fixed* bit pattern:
4143///
4244/// ```rust,no_run
45+ /// # #![allow(invalid_value)]
4346/// use std::mem::{self, MaybeUninit};
4447///
4548/// 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 {
445445///
446446/// *Incorrect* usage of this function: initializing a reference with zero.
447447///
448- /// ```no_run
448+ /// ```rust,no_run
449+ /// # #![allow(invalid_value)]
449450/// use std::mem;
450451///
451452/// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!
You can’t perform that action at this time.
0 commit comments