diff options
| author | Ralf Jung <post@ralfj.de> | 2020-04-28 23:54:47 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-04-28 23:54:47 +0200 |
| commit | a0898019485fd0920957444b7b387eec5f2b112d (patch) | |
| tree | b591672afd158ea42e7c1313d1a6a77a04149fae | |
| parent | a84e2a0c91613e92ebf946d650b315aa2cd111a1 (diff) | |
clarify comment
| -rw-r--r-- | src/librustc_mir/const_eval/machine.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs index ce9d25599ff..7c1ab261eb9 100644 --- a/src/librustc_mir/const_eval/machine.rs +++ b/src/librustc_mir/const_eval/machine.rs @@ -343,7 +343,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, // Machine configuration does not allow us to read statics // (e.g., `const` initializer). // See const_eval::machine::MemoryExtra::can_access_statics for why - // this check is so important. + // this check is so important: if we could read statics, we could read pointers + // to mutable allocations *inside* statics. These allocations are not themselves + // statics, so pointers to them can get around the check in `validity.rs`. Err(ConstEvalErrKind::ConstAccessesStatic.into()) } else { // Immutable global, this read is fine. |
