about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-04-03 14:51:05 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-04-03 14:51:05 +0200
commitbda6d1f158a71efe84d86da2011eac0c45a232c5 (patch)
treeed79a1634dc89af429e193096495dc6aaad7a823 /compiler/rustc_data_structures
parent5773e516787a90df4ed014cd20eed0226a1f63cd (diff)
downloadrust-bda6d1f158a71efe84d86da2011eac0c45a232c5.tar.gz
rust-bda6d1f158a71efe84d86da2011eac0c45a232c5.zip
Add safety comment to StableAddress impl for Mmap
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/memmap.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/memmap.rs b/compiler/rustc_data_structures/src/memmap.rs
index 29e999efeb1..26b26415eea 100644
--- a/compiler/rustc_data_structures/src/memmap.rs
+++ b/compiler/rustc_data_structures/src/memmap.rs
@@ -40,4 +40,8 @@ impl Deref for Mmap {
     }
 }
 
+// SAFETY: On architectures other than WASM, mmap is used as backing storage. The address of this
+// memory map is stable. On WASM, `Vec<u8>` is used as backing storage. The `Mmap` type doesn't
+// export any function that can cause the `Vec` to be re-allocated. As such the address of the
+// bytes inside this `Vec` is stable.
 unsafe impl StableAddress for Mmap {}