]> git.lizzy.rs Git - rust.git/commitdiff
tweak MaybeUninit docs
authorRalf Jung <post@ralfj.de>
Sat, 6 Mar 2021 15:59:39 +0000 (16:59 +0100)
committerRalf Jung <post@ralfj.de>
Sat, 6 Mar 2021 15:59:39 +0000 (16:59 +0100)
library/core/src/mem/maybe_uninit.rs

index 26314213ff7306713141b11b75bc8a4421e867a1..cb072931232de22f8243ae0bf1fa9bd2d0c3796e 100644 (file)
 /// 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)]