@@ -2,11 +2,6 @@ use std::borrow::Borrow;
2
2
use std:: ops:: Deref ;
3
3
use std:: sync:: Arc ;
4
4
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
-
10
5
/// An owned slice.
11
6
///
12
7
/// This is similar to `Arc<[u8]>` but allows slicing and using anything as the
@@ -34,7 +29,7 @@ pub struct OwnedSlice {
34
29
// \/
35
30
// ⊂(´・◡・⊂ )∘˚˳° (I am the phantom remnant of #97770)
36
31
#[ expect( dead_code) ]
37
- owner : Arc < dyn sync :: Send + sync :: Sync > ,
32
+ owner : Arc < dyn Send + Sync > ,
38
33
}
39
34
40
35
/// Makes an [`OwnedSlice`] out of an `owner` and a `slicer` function.
@@ -61,7 +56,7 @@ pub struct OwnedSlice {
61
56
/// ```
62
57
pub fn slice_owned < O , F > ( owner : O , slicer : F ) -> OwnedSlice
63
58
where
64
- O : sync :: Send + sync :: Sync + ' static ,
59
+ O : Send + Sync + ' static ,
65
60
F : FnOnce ( & O ) -> & [ u8 ] ,
66
61
{
67
62
try_slice_owned ( owner, |x| Ok :: < _ , !> ( slicer ( x) ) ) . into_ok ( )
72
67
/// See [`slice_owned`] for the infallible version.
73
68
pub fn try_slice_owned < O , F , E > ( owner : O , slicer : F ) -> Result < OwnedSlice , E >
74
69
where
75
- O : sync :: Send + sync :: Sync + ' static ,
70
+ O : Send + Sync + ' static ,
76
71
F : FnOnce ( & O ) -> Result < & [ u8 ] , E > ,
77
72
{
78
73
// We wrap the owner of the bytes in, so it doesn't move.
@@ -139,10 +134,10 @@ impl Borrow<[u8]> for OwnedSlice {
139
134
}
140
135
141
136
// 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 { }
143
138
144
139
// 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 { }
146
141
147
142
#[ cfg( test) ]
148
143
mod tests;
0 commit comments