Skip to content

Commit d79f9ca

Browse files
committed
compiler/rustc_data_structures/src/sync.rs: delete Sync and Send
1 parent 4a2c7f4 commit d79f9ca

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

compiler/rustc_data_structures/src/owned_slice.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ use std::borrow::Borrow;
22
use std::ops::Deref;
33
use std::sync::Arc;
44

5-
// Use our fake Send/Sync traits when on not parallel compiler,
6-
// so that `OwnedSlice` only implements/requires Send/Sync
7-
// for parallel compiler builds.
8-
use crate::sync;
9-
105
/// An owned slice.
116
///
127
/// This is similar to `Arc<[u8]>` but allows slicing and using anything as the
@@ -34,7 +29,7 @@ pub struct OwnedSlice {
3429
// \/
3530
// ⊂(´・◡・⊂ )∘˚˳° (I am the phantom remnant of #97770)
3631
#[expect(dead_code)]
37-
owner: Arc<dyn sync::Send + sync::Sync>,
32+
owner: Arc<dyn Send + Sync>,
3833
}
3934

4035
/// Makes an [`OwnedSlice`] out of an `owner` and a `slicer` function.
@@ -61,7 +56,7 @@ pub struct OwnedSlice {
6156
/// ```
6257
pub fn slice_owned<O, F>(owner: O, slicer: F) -> OwnedSlice
6358
where
64-
O: sync::Send + sync::Sync + 'static,
59+
O: Send + Sync + 'static,
6560
F: FnOnce(&O) -> &[u8],
6661
{
6762
try_slice_owned(owner, |x| Ok::<_, !>(slicer(x))).into_ok()
@@ -72,7 +67,7 @@ where
7267
/// See [`slice_owned`] for the infallible version.
7368
pub fn try_slice_owned<O, F, E>(owner: O, slicer: F) -> Result<OwnedSlice, E>
7469
where
75-
O: sync::Send + sync::Sync + 'static,
70+
O: Send + Sync + 'static,
7671
F: FnOnce(&O) -> Result<&[u8], E>,
7772
{
7873
// We wrap the owner of the bytes in, so it doesn't move.
@@ -139,10 +134,10 @@ impl Borrow<[u8]> for OwnedSlice {
139134
}
140135

141136
// Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Arc<dyn Send + Sync>)`, which is `Send`
142-
unsafe impl sync::Send for OwnedSlice {}
137+
unsafe impl Send for OwnedSlice {}
143138

144139
// Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Arc<dyn Send + Sync>)`, which is `Sync`
145-
unsafe impl sync::Sync for OwnedSlice {}
140+
unsafe impl Sync for OwnedSlice {}
146141

147142
#[cfg(test)]
148143
mod tests;

compiler/rustc_data_structures/src/sync.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ mod mode {
9797

9898
// FIXME(parallel_compiler): Get rid of these aliases across the compiler.
9999

100-
pub use std::marker::{Send, Sync};
101100
pub use std::sync::OnceLock;
102101
// Use portable AtomicU64 for targets without native 64-bit atomics
103102
#[cfg(target_has_atomic = "64")]

0 commit comments

Comments
 (0)