You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference/src/glossary.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,12 @@
4
4
[abstract byte]: #abstract-byte
5
5
6
6
The "byte" is the smallest unit of storage in Rust.
7
-
Memory allocations are thought of as storing a list of bytes, and at the lowest level each load return a list of bytes and each store takes a list of bytes and puts it into memory.
7
+
Memory allocations are thought of as storing a list of bytes, and at the lowest level each load returns a list of bytes and each store takes a list of bytes and puts it into memory.
8
8
(The [representation relation] then defines how to convert between those lists of bytes and higher-level values such as mathematical integers or pointers.)
9
9
10
-
However, a "byte" in the Rust Abstract Machine is more complicated than just a `u8` -- think if it as there being some extra "shadow state" that is relevant for the Abstract Machine execution (in particular, for whether this execution has UB), but that disappears when compiling the program to assembly.
11
-
That's why we call it "abstract byte", to distinguish it from the physical machine byte that is represented by a `u8`.
10
+
However, a "byte" in the Rust Abstract Machine is more complicated than just an integer in `0..256` -- think of it as there being some extra "shadow state" that is relevant for the Abstract Machine execution (in particular, for whether this execution has UB), but that disappears when compiling the program to assembly.
11
+
That's why we call it "abstract byte", to distinguish it from the physical machine byte in `0..256`.
12
+
12
13
The most obvious "shadow state" is tracking whether memory is initialized.
13
14
See [this blog post](https://www.ralfj.de/blog/2019/07/14/uninit.html) for details, but the gist of it is that bytes in memory are more like `Option<u8>` where `None` indicates that this byte is uninitialized.
14
15
Operations like `copy` work on that representation, so if you copy from some uninitialized memory into initialized memory, the target memory becomes "de-initialized".
@@ -21,7 +22,8 @@ Without committing to the exact shape of provenance in Rust, we can therefore sa
21
22
pubenumAbstractByte<Provenance> {
22
23
/// An uninitialized byte.
23
24
Uninit,
24
-
/// An initialized byte, optionally with some provenance (if it is encoding a pointer).
25
+
/// An initialized byte with a value in `0..256`,
26
+
/// optionally with some provenance (if it is encoding a pointer).
0 commit comments