diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index ea5b1057c02a4..08c82e47e177b 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -494,7 +494,7 @@ pub const fn needs_drop() -> bool { /// /// *Incorrect* usage of this function: initializing a reference with zero. /// -/// ``` +/// ```no_run /// use std::mem; /// /// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior! @@ -987,7 +987,7 @@ impl DerefMut for ManuallyDrop { /// /// On top of that, remember that most types have additional invariants beyond merely /// being considered initialized at the type level. For example, a `1`-initialized [`Vec`] -/// is considered initialized because the only requirement the compiler knows about +/// is considered initialized because the only requirement the compiler knows about it /// is that the data pointer must be non-null. Creating such a `Vec` does not cause /// *immediate* undefined behavior, but will cause undefined behavior with most /// safe operations (including dropping it). @@ -1025,8 +1025,8 @@ impl DerefMut for ManuallyDrop { /// /// let data = unsafe { /// // Create an uninitialized array of `MaybeUninit`. The `assume_init` is -/// // safe because we type we are claiming to have initialized here is a -/// // bunch of `MaybeUninit`, which do not require initialization. +/// // safe because the type we are claiming to have initialized here is a +/// // bunch of `MaybeUninit`s, which do not require initialization. /// let mut data: [MaybeUninit>; 1000] = MaybeUninit::uninit().assume_init(); /// /// // Dropping a `MaybeUninit` does nothing, so if there is a panic during this loop, @@ -1052,9 +1052,9 @@ impl DerefMut for ManuallyDrop { /// /// unsafe { /// // Create an uninitialized array of `MaybeUninit`. The `assume_init` is -/// // safe because we type we are claiming to have initialized here is a -/// // bunch of `MaybeUninit`, which do not require initialization. -/// let mut data: [MaybeUninit; 500] = MaybeUninit::uninit().assume_init(); +/// // safe because the type we are claiming to have initialized here is a +/// // bunch of `MaybeUninit`s, which do not require initialization. +/// let mut data: [MaybeUninit; 1000] = MaybeUninit::uninit().assume_init(); /// // Count the number of elements we have assigned. /// let mut data_len: usize = 0; ///