From 1701957af94bd61cf448bc942de3159555bf9376 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 9 Aug 2026 12:08:06 +0200 Subject: [PATCH] aliasing rule summary: use a bulleted list --- src/behavior-considered-undefined.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/behavior-considered-undefined.md b/src/behavior-considered-undefined.md index a26328bccc..935f0dd9fa 100644 --- a/src/behavior-considered-undefined.md +++ b/src/behavior-considered-undefined.md @@ -24,7 +24,11 @@ r[undefined.place-projection] r[undefined.alias] * Breaking the pointer aliasing rules. The exact aliasing rules are not determined yet, but here is an outline of the general principles: - `&T` must point to memory that is not mutated while they are live (except for data inside an [`UnsafeCell`]), and `&mut T` must point to memory that is not read or written by any pointer not derived from the reference and that no other reference points to while they are live (with no exceptions). `Box` is treated similar to `&'static mut T` for the purpose of these rules. These rules apply to *all* references and `Box`, including those stored inside private fields (e.g., if your type has a private field of type `&mut T`, that reference must be unique in the sense described above for as long as values of your type are live). + * `&T` must point to memory that is not mutated while they are live (except for data inside an [`UnsafeCell`]). + * `&mut T` must point to memory that is not read or written by any pointer not derived from the reference and that no other reference points to while they are live (with no exceptions). + * `Box` is treated similar to `&'static mut T` for the purpose of these rules. + + These rules apply to *all* references and `Box`, including those stored inside private fields (e.g., if your type has a private field of type `&mut T`, that reference must be unique in the sense described above for as long as values of your type are live). The exact liveness duration is not specified, but some bounds exist: