about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/memmap.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/memmap.rs b/compiler/rustc_data_structures/src/memmap.rs
index 917416df6b8..47d5d88363b 100644
--- a/compiler/rustc_data_structures/src/memmap.rs
+++ b/compiler/rustc_data_structures/src/memmap.rs
@@ -40,6 +40,12 @@ impl Deref for Mmap {
     }
 }
 
+impl AsRef<[u8]> for Mmap {
+    fn as_ref(&self) -> &[u8] {
+        &*self.0
+    }
+}
+
 // 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