Skip to content

Commit 717aeb8

Browse files
authored
Merge pull request rust-lang#36 from RalfJung/immutable-check
update immutable-checking situation
2 parents 8c969a9 + 9536fcd commit 717aeb8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

const.md

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ is actually accepted by the compiler because we know that there is no
5858

5959
*Dynamic check.* The Miri engine enforces this dynamically by ensuring that the
6060
new data that is interned for a constant is all marked as immutable.
61+
(Except for
62+
[data inside promoteds](https://github.com/rust-lang/rust/blob/d538b80ad77949e46989cd355cdec193b574f052/src/librustc_mir/interpret/intern.rs#L363-L367)
63+
which cannot easily be checked, and is thus just *marked* as immutable because
64+
it descends from a shared reference subject to the strict syntactic checks of
65+
lifetime extension.)
6166

6267
Note that a constant *referring to* some already existing mutable memory is
6368
fine: inlining that reference everywhere has the same behavior as computing a

0 commit comments

Comments
 (0)