Skip to content

Commit 99419ea

Browse files
committed
Delete owning_ref from rustc_data_structures
`owning_ref` has soundness problems when used with `Box<T>`, and the previous commit replaced its usages with a better abstraction. This means that we can now get rid of it.
1 parent 0974fd6 commit 99419ea

File tree

5 files changed

+5
-1955
lines changed

5 files changed

+5
-1955
lines changed

compiler/rustc_data_structures/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![feature(test)]
2727
#![feature(thread_id_value)]
2828
#![feature(vec_into_raw_parts)]
29+
#![feature(ptr_sub_ptr)]
2930
#![allow(rustc::default_hash_types)]
3031
#![allow(rustc::potential_query_instability)]
3132

@@ -76,7 +77,6 @@ pub mod jobserver;
7677
pub mod macros;
7778
pub mod map_in_place;
7879
pub mod obligation_forest;
79-
pub mod owning_ref;
8080
pub mod sip128;
8181
pub mod small_c_str;
8282
pub mod small_str;
@@ -103,6 +103,7 @@ pub mod vec_map;
103103
pub mod work_queue;
104104
pub use atomic_ref::AtomicRef;
105105
pub mod frozen;
106+
pub mod owned_slice;
106107
pub mod sso;
107108
pub mod steal;
108109
pub mod tagged_ptr;

compiler/rustc_data_structures/src/memmap.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use std::fs::File;
22
use std::io;
33
use std::ops::Deref;
44

5-
use crate::owning_ref::StableAddress;
5+
// FIXME(nilstrieb): This was created to implement owning_ref::StableAddress.
6+
// Since owning_ref has been deleted, this can be removed as well.
67

7-
/// A trivial wrapper for [`memmap2::Mmap`] that implements [`StableAddress`].
8+
/// A trivial wrapper for [`memmap2::Mmap`] that implements owning_ref::StableAddress.
89
#[cfg(not(target_arch = "wasm32"))]
910
pub struct Mmap(memmap2::Mmap);
1011

@@ -39,9 +40,3 @@ impl Deref for Mmap {
3940
&*self.0
4041
}
4142
}
42-
43-
// SAFETY: On architectures other than WASM, mmap is used as backing storage. The address of this
44-
// memory map is stable. On WASM, `Vec<u8>` is used as backing storage. The `Mmap` type doesn't
45-
// export any function that can cause the `Vec` to be re-allocated. As such the address of the
46-
// bytes inside this `Vec` is stable.
47-
unsafe impl StableAddress for Mmap {}

compiler/rustc_data_structures/src/owning_ref/LICENSE

-21
This file was deleted.

0 commit comments

Comments
 (0)