Skip to content

Commit 8df3c0c

Browse files
rcseacordmanhatsu
authored andcommitted
Update types-and-traits.rst
1 parent 2754d38 commit 8df3c0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
Unions allow multiple fields to occupy the same memory, similar to C unions.
3030
Unlike enumeration types, unions do not track which field is currently active.
3131
You must ensure that when a field is read,
32-
the underlying bytes are valid for that field's type [1]_.
32+
the underlying bytes are valid for that field's type [UNION]_.
3333
3434
Every type has a *validity invariant* — a set of constraints that all values of
35-
that type must satisfy [2]_.
35+
that type must satisfy [VALID]_.
3636
Reading a union field performs a *typed read*,
3737
which asserts that the bytes are valid for the target type.
3838
Violating this invariant is undefined behavior.
@@ -289,9 +289,9 @@
289289
:header-rows: 0
290290
:widths: 5 85
291291

292-
* - .. [1]
292+
* - .. [UNION]
293293
- The Rust Project Developers. "Rust Reference: Unions." *The Rust Reference*, n.d. https://doc.rust-lang.org/reference/items/unions.html.
294-
* - .. [2]
294+
* - .. [VALID]
295295
- 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.
296296

297297
>>>>>>> c93b2cb (Update types-and-traits.rst):src/coding-guidelines/types-and-traits.rst

0 commit comments

Comments
 (0)