Skip to content

Commit ff494bf

Browse files
committed
bytes inside implicitly const-promoted expressions are immutable
1 parent 8c789ff commit ff494bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/behavior-considered-undefined.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Please read the [Rustonomicon] before writing unsafe code.
4949
All this also applies when values of these
5050
types are passed in a (nested) field of a compound type, but not behind
5151
pointer indirections.
52-
* Mutating immutable bytes. All bytes inside a [`const`] item are immutable.
52+
* Mutating immutable bytes. All bytes inside a [`const`] item or within an implicitly [const-promoted] expression are immutable.
5353
The bytes owned by an immutable binding or immutable `static` are immutable, unless those bytes are part of an [`UnsafeCell<U>`].
5454

5555
Moreover, the bytes [pointed to] by a shared reference, including transitively through other references (both shared and mutable) and `Box`es, are immutable; transitivity includes those references stored in fields of compound types.
@@ -189,3 +189,4 @@ reading uninitialized memory is permitted are inside `union`s and in "padding"
189189
[project-field]: expressions/field-expr.md
190190
[project-tuple]: expressions/tuple-expr.md#tuple-indexing-expressions
191191
[project-slice]: expressions/array-expr.md#array-and-slice-indexing-expressions
192+
[const-promoted]: destructors.md#constant-promotion

0 commit comments

Comments
 (0)