]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #70947 - RalfJung:ctfe-no-read-mut-global, r=oli-obk
authorDylan DPC <dylan.dpc@gmail.com>
Tue, 14 Apr 2020 21:29:52 +0000 (23:29 +0200)
committerGitHub <noreply@github.com>
Tue, 14 Apr 2020 21:29:52 +0000 (23:29 +0200)
tighten CTFE safety net for accesses to globals

Previously, we only rejected reading from all statics. Now we also reject reading from any mutable global. Mutable globals are the true culprit here as their run-time value might be different from their compile-time values. Statics are just the approximation we use for that so far.

Also refactor the code a bit to make it clearer what is being checked and allowed.

r? @oli-obk

1  2 
src/librustc_mir/const_eval/machine.rs