about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2020-04-23 13:24:50 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2020-04-23 15:56:26 +0200
commite4ab4ee020479d9312560e29056313ee9836c6d2 (patch)
treedf4604438f80667e40802d7235a7b2826bdea731
parentaf44cdf04fddf4d18efee49c0c683cb4bbce71fa (diff)
downloadrust-e4ab4ee020479d9312560e29056313ee9836c6d2.tar.gz
rust-e4ab4ee020479d9312560e29056313ee9836c6d2.zip
Update src/librustc_mir/interpret/memory.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
-rw-r--r--src/librustc_mir/interpret/memory.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index 43b2f0e9110..6f8b0c1445a 100644
--- a/src/librustc_mir/interpret/memory.rs
+++ b/src/librustc_mir/interpret/memory.rs
@@ -404,7 +404,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
                     // We may be reading from a static.
                     // In order to ensure that `static FOO: Type = FOO;` causes a cycle error
                     // instead of magically pulling *any* ZST value from the ether, we need to
-                    // trigger a read here.
+                    // actually access the referenced allocation. The caller is likely
+                    // to short-circuit on `None`, so we trigger the access here to
+                    // make sure it happens.
                     self.get_raw(ptr.alloc_id)?;
                     None
                 } else {