Skip to content

Commit 444db76

Browse files
authored
Update types-and-traits.rst
1 parent 987728d commit 444db76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/coding-guidelines/types-and-traits.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Types and Traits
3737
Unions allow multiple fields to occupy the same memory, similar to C unions.
3838
Unlike enumeration types, unions do not track which field is currently active.
3939
You must ensure that when a field is read,
40-
the underlying bytes are valid for that field's type [1]_.
40+
the underlying bytes are valid for that field's type [UNION]_.
4141

4242
Every type has a *validity invariant* — a set of constraints that all values of
43-
that type must satisfy [2]_.
43+
that type must satisfy [VALID]_.
4444
Reading a union field performs a *typed read*,
4545
which asserts that the bytes are valid for the target type.
4646
Violating this invariant is undefined behavior.
@@ -297,9 +297,9 @@ Types and Traits
297297
:header-rows: 0
298298
:widths: 5 85
299299
300-
* - .. [1]
300+
* - .. [UNION]
301301
- The Rust Project Developers. "Rust Reference: Unions." *The Rust Reference*, n.d. https://doc.rust-lang.org/reference/items/unions.html.
302-
* - .. [2]
302+
* - .. [VALID]
303303
- Rust Unsafe Code Guidelines Working Group. "Validity and Safety Invariant." *Rust Unsafe Code Guidelines*, n.d. https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#validity-and-safety-invariant.
304304
305305
.. guideline:: Use strong types to differentiate between logically distinct values

0 commit comments

Comments
 (0)