Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Memory model

Warning

The memory model of Rust is incomplete and not fully decided.

Bytes

The most basic unit of memory in Rust is a byte.

Note

While bytes are typically lowered to hardware bytes, Rust uses an “abstract” notion of bytes that can make distinctions which are absent in hardware, such as being uninitialized, or storing part of a pointer. Those distinctions can affect whether your program has undefined behavior, so they still have tangible impact on how compiled Rust programs behave.

Each byte may have one of the following values:

  • An initialized byte containing a u8 value and optional provenance,
  • An uninitialized byte.

Note

The above list is not yet guaranteed to be exhaustive.