Skip to content

Commit 754de4e

Browse files
committed
tweak wording
1 parent 79b26a7 commit 754de4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

reference/src/glossary.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#### Interior mutability
44

5-
*Interior Mutability* means mutating memory where there also exists a live shared reference pointing to the same memory; or mutating memory through a pointer derived from a shared reference.
5+
*Interior Mutation* means mutating memory where there also exists a live shared reference pointing to the same memory; or mutating memory through a pointer derived from a shared reference.
66
"live" here means a value that will be "used again" later.
77
"derived from" means that the pointer was obtained by casting a shared reference and potentially adding an offset.
88
This is not yet precisely defined, which will be fixed as part of developing a precise aliasing model.
@@ -11,7 +11,8 @@ Finding live shared references propagates recursively through references, but no
1111
So, for example, if data immediately pointed to by a `&T` or `& &mut T` is mutated, that's interior mutability.
1212
If data immediately pointed to by a `*const T` or `&*const T` is mutated, that's *not* interior mutability.
1313

14-
Interior mutability is only allowed inside [`UnsafeCell`](https://doc.rust-lang.org/core/cell/struct.UnsafeCell.html).
14+
*Interior mutability* refers to the ability to perform interior mutation without causing UB.
15+
All interior mutation in Rust has to happen inside an [`UnsafeCell`](https://doc.rust-lang.org/core/cell/struct.UnsafeCell.html), so all data structures that have interior mutability must (directly or indirectly) use `UnsafeCell` for this purpose.
1516

1617
#### Validity and safety invariant
1718

0 commit comments

Comments
 (0)