@@ -2,11 +2,6 @@ use std::borrow::Borrow;
22use std:: ops:: Deref ;
33use 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/// ```
6257pub fn slice_owned < O , F > ( owner : O , slicer : F ) -> OwnedSlice
6358where
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 ( )
7267/// See [`slice_owned`] for the infallible version.
7368pub fn try_slice_owned < O , F , E > ( owner : O , slicer : F ) -> Result < OwnedSlice , E >
7469where
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) ]
148143mod tests;
0 commit comments