about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-07 10:41:22 +0900
committerGitHub <noreply@github.com>2021-03-07 10:41:22 +0900
commit6220e00ea9a790fb83cf391e2093c260db6d47a1 (patch)
treec91086d0e3c6cff3ed331adc66931e17281701f8
parent74ae20e2c6b6b2a0f839a42b0fd40cb976e7eaca (diff)
parentb75154897bd5a4f4e0678e1d0539db6f59f85ba1 (diff)
downloadrust-6220e00ea9a790fb83cf391e2093c260db6d47a1.tar.gz
rust-6220e00ea9a790fb83cf391e2093c260db6d47a1.zip
Rollup merge of #82837 - RalfJung:maybe-uninit, r=dtolnay
tweak MaybeUninit docs

Explain what "(no) fixed value" means.
-rw-r--r--library/core/src/mem/maybe_uninit.rs9
1 files changed, 5 insertions, 4 deletions
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 @@ use crate::ptr;
 /// 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)]