Skip to content

Commit 0354510

Browse files
committed
clarify alloc_map description
1 parent e0b17ad commit 0354510

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc_mir/interpret/memory.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> {
5252
/// Allocations local to this instance of the miri engine. The kind
5353
/// helps ensure that the same mechanism is used for allocation and
5454
/// deallocation. When an allocation is not found here, it is a
55-
/// static and looked up in the `tcx` for read access. Writing to
56-
/// a static creates a copy here, in the machine.
57-
/// We have this in a RefCell to be able to cache when a new allocation
58-
/// for a static has to be created on a read access.
55+
/// static and looked up in the `tcx` for read access. If this machine
56+
/// does pointer provenance tracking, the type of alloctions in `tcx`
57+
/// and here do not match, so we have a `MonoHashMap` to be able to
58+
/// put the "mapped" allocation into `alloc_map` even on a read access.
59+
/// Either way, if the machine allows writing to a static, doing so will
60+
/// create a copy of the static allocation here.
5961
alloc_map: MonoHashMap<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<M::PointerTag>)>,
6062

6163
/// To be able to compare pointers with NULL, and to check alignment for accesses

0 commit comments

Comments
 (0)