Skip to content

Commit bda6d1f

Browse files
committed
Add safety comment to StableAddress impl for Mmap
1 parent 5773e51 commit bda6d1f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_data_structures/src/memmap.rs

+4
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ impl Deref for Mmap {
4040
}
4141
}
4242

43+
// SAFETY: On architectures other than WASM, mmap is used as backing storage. The address of this
44+
// memory map is stable. On WASM, `Vec<u8>` is used as backing storage. The `Mmap` type doesn't
45+
// export any function that can cause the `Vec` to be re-allocated. As such the address of the
46+
// bytes inside this `Vec` is stable.
4347
unsafe impl StableAddress for Mmap {}

0 commit comments

Comments
 (0)