Skip to content

Commit 3d7ee4f

Browse files
authored
Merge pull request #1554 from RalfJung/promoted-immutable
bytes inside implicitly const-promoted expressions are immutable
2 parents 9c0e24b + ff494bf commit 3d7ee4f

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.
@@ -187,3 +187,4 @@ reading uninitialized memory is permitted are inside `union`s and in "padding"
187187
[project-field]: expressions/field-expr.md
188188
[project-tuple]: expressions/tuple-expr.md#tuple-indexing-expressions
189189
[project-slice]: expressions/array-expr.md#array-and-slice-indexing-expressions
190+
[const-promoted]: destructors.md#constant-promotion

0 commit comments

Comments
 (0)