Skip to content

Commit

Permalink
Update src/librustc_mir/interpret/memory.rs
Browse files Browse the repository at this point in the history
Co-Authored-By: Ralf Jung <post@ralfj.de>
  • Loading branch information
oli-obk and RalfJung committed Apr 23, 2020
1 parent af44cdf commit e4ab4ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e4ab4ee

Please sign in to comment.