]> git.proxmox.com Git - rustc.git/blame - src/doc/nomicon/src/uninitialized.md
New upstream version 1.54.0+dfsg1
[rustc.git] / src / doc / nomicon / src / uninitialized.md
CommitLineData
8bb4bdeb 1# Working With Uninitialized Memory
c1a9b12d
SL
2
3All runtime-allocated memory in a Rust program begins its life as
4*uninitialized*. In this state the value of the memory is an indeterminate pile
5of bits that may or may not even reflect a valid state for the type that is
6supposed to inhabit that location of memory. Attempting to interpret this memory
b039eaaf 7as a value of *any* type will cause Undefined Behavior. Do Not Do This.
c1a9b12d
SL
8
9Rust provides mechanisms to work with uninitialized memory in checked (safe) and
b039eaaf 10unchecked (unsafe) ways.