From: Ralf Jung Date: Sat, 6 Mar 2021 15:59:39 +0000 (+0100) Subject: tweak MaybeUninit docs X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b75154897bd5a4f4e0678e1d0539db6f59f85ba1;p=rust.git tweak MaybeUninit docs --- diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 26314213ff7..cb072931232 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -39,10 +39,11 @@ /// let b: bool = unsafe { MaybeUninit::uninit().assume_init() }; // undefined behavior! ⚠️ /// ``` /// -/// Moreover, uninitialized memory is special in that the compiler knows that -/// it does not have a fixed value. This makes it undefined behavior to have -/// uninitialized data in a variable even if that variable has an integer type, -/// which otherwise can hold any *fixed* bit pattern: +/// Moreover, uninitialized memory is special in that it does not have a fixed value ("fixed" +/// meaning "it won't change without being written to"). Reading the same uninitialized byte +/// multiple times can give different results. This makes it undefined behavior to have +/// uninitialized data in a variable even if that variable has an integer type, which otherwise can +/// hold any *fixed* bit pattern: /// /// ```rust,no_run /// # #![allow(invalid_value)]