Skip to content

Commit 78cad03

Browse files
committed
explain what the type of a place does
1 parent 2fa1658 commit 78cad03

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

reference/src/glossary.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,20 @@ requirement of 2.
142142

143143
A *place* (called "lvalue" in C and "glvalue" in C++) is the result of computing a [*place expression*][place-value-expr].
144144
A place is basically a pointer (pointing to some location in memory, potentially carrying [provenance](#pointer-provenance)), but might contain more information such as size or alignment (the details will have to be determined as the Rust Abstract Machine gets specified more precisely).
145-
A place has a type.
146-
Places cannot be "stored" in memory, only [values](#value) can.
145+
A place has a type, indicating the type of [values](#value) that it stores.
146+
Places cannot be "stored" in memory, only values can.
147147

148148
The key operations on a place are:
149149
* storing a [value](#value) of the same type in it (when it is used on the left-hand side of an assignment),
150-
* turning it into a [pointer value](#value) (when it is used inside `&expr`),
150+
* turning it into a [pointer value](#value) (when it is used inside `&expr`), which is also the only way to "store" a place,
151151
* and loading a [value](#value) of the same type from it (through the place-to-value coercion).
152152

153153

154154
#### Value
155155

156156
A *value* (called "value of the expression" or "rvalue" in C and "prvalue" in C++) is what gets stored in a [place](#place), and also the result of computing a [*value expression*][place-value-expr].
157157
A value has a type, and it denotes the abstract mathematical concept that is represented by data in our programs.
158+
158159
For example, a value of type `u8` is a mathematical integer in the range `0..256`.
159160
Values can be (according to their type) turned into a list of bytes, which is called a [representation](#representation) of the value.
160161
Values are ephemeral; they arise during the computation of an instruction but are only ever persisted in memory through their representation.

0 commit comments

Comments
 (0)