Skip to content

Commit b777f71

Browse files
committed
1.36.0: random -> uninitialized.
1 parent 0f4a009 commit b777f71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

posts/2019-07-04-Rust-1.36.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ One of the main uses of this function has been to lazily allocate arrays.
8181
However, [`mem::uninitialized`] is an incredibly dangerous operation that essentially
8282
cannot be used correctly as the Rust compiler assumes that values are properly initialized.
8383
For example, calling `mem::uninitialized::<bool>()` causes *instantaneous __undefined behavior__*
84-
as the random bits in memory could be something other than `0` (for `false`) and `1` (for `true`)
85-
-- the only two allowed bit patterns for `bool`.
84+
as the uninitialized bits could be something other than `0` (for `false`)
85+
and `1` (for `true`) -- the only two allowed bit patterns for `bool`.
8686

8787
To remedy this situation, in Rust 1.36.0, the type [`MaybeUninit<T>`] has been [stabilized][pr-60445].
8888
The Rust compiler will understand that it should not assume that a [`MaybeUninit<T>`] is a properly initialized `T`.

0 commit comments

Comments
 (0)