Skip to content

Commit d705654

Browse files
committed
Yeet owning_ref
Turns out - `owning_ref` is unsound due to `Box` aliasing stuff - `rustc` doesn't need 99% of the `owning_ref` API - `rustc` can use a far simpler abstraction that is `OwnedSlice`
1 parent c0ceefd commit d705654

File tree

6 files changed

+1
-1971
lines changed

6 files changed

+1
-1971
lines changed

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub mod intern;
6161
pub mod jobserver;
6262
pub mod macros;
6363
pub mod obligation_forest;
64-
pub mod owning_ref;
6564
pub mod sip128;
6665
pub mod small_c_str;
6766
pub mod small_str;

compiler/rustc_data_structures/src/memmap.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ use std::fs::File;
22
use std::io;
33
use std::ops::{Deref, DerefMut};
44

5-
use crate::owning_ref::StableAddress;
6-
7-
/// A trivial wrapper for [`memmap2::Mmap`] that implements [`StableAddress`].
5+
/// A trivial wrapper for [`memmap2::Mmap`] (or `Vec<u8>` on WASM).
86
#[cfg(not(target_arch = "wasm32"))]
97
pub struct Mmap(memmap2::Mmap);
108

@@ -46,12 +44,6 @@ impl AsRef<[u8]> for Mmap {
4644
}
4745
}
4846

49-
// SAFETY: On architectures other than WASM, mmap is used as backing storage. The address of this
50-
// memory map is stable. On WASM, `Vec<u8>` is used as backing storage. The `Mmap` type doesn't
51-
// export any function that can cause the `Vec` to be re-allocated. As such the address of the
52-
// bytes inside this `Vec` is stable.
53-
unsafe impl StableAddress for Mmap {}
54-
5547
#[cfg(not(target_arch = "wasm32"))]
5648
pub struct MmapMut(memmap2::MmapMut);
5749

compiler/rustc_data_structures/src/owning_ref/LICENSE

-21
This file was deleted.

0 commit comments

Comments
 (0)