Skip to content

Commit 9fe0618

Browse files
committed
Define byte
This is split off from rust-lang#1664 which defines what a "byte" is. Closes rust-lang#1673
1 parent 49a9c8c commit 9fe0618

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/memory-model.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
r[memory]
12
# Memory model
23

3-
Rust does not yet have a defined memory model. Various academics and industry professionals
4-
are working on various proposals, but for now, this is an under-defined place
5-
in the language.
4+
> [!WARNING]
5+
> The memory model of Rust is incomplete and not fully decided.
6+
7+
r[memory.bytes]
8+
## Bytes
9+
10+
r[memory.bytes.intro]
11+
The most basic unit of memory in Rust is a byte. All values are computed from zero or more bytes read from an allocation.
12+
13+
> [!NOTE]
14+
> 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.
15+
16+
r[memory.bytes.contents]
17+
Each byte may have one of the following values:
18+
19+
r[memory.bytes.init]
20+
* An initialized byte containing a `u8` value and optional [provenance][std::ptr#provenance],
21+
22+
r[memory.bytes.uninit]
23+
* An uninitialized byte.
24+
25+
> [!NOTE]
26+
> The above list is not yet guaranteed to be exhaustive.

0 commit comments

Comments
 (0)