about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-03 15:07:39 +0000
committerbors <bors@rust-lang.org>2022-12-03 15:07:39 +0000
commitcab4fd678c5b148a330f2bf255bf28a67dfea0fc (patch)
treeeb14414a1876cb31bc742ce555b708be3ecbb8a3 /compiler/rustc_data_structures/src
parent4bb15759d7eb519be70c9a955dba9be09e13c06d (diff)
parenta99838a1151ee0c8423a7c3d32789a7c03adbf41 (diff)
downloadrust-cab4fd678c5b148a330f2bf255bf28a67dfea0fc.tar.gz
rust-cab4fd678c5b148a330f2bf255bf28a67dfea0fc.zip
Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiser
Rewrite LLVM's archive writer in Rust

This allows it to be used by other codegen backends.

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
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