From be6708428fdf6693188e2c2f10f05d1b1aaa5750 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 28 May 2022 10:43:51 +0000 Subject: Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends --- compiler/rustc_data_structures/src/memmap.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/rustc_data_structures/src') 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` 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 -- cgit 1.4.1-3-g733a5