File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ pub struct Rc<
318
318
#[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
319
319
> {
320
320
ptr : NonNull < RcBox < T > > ,
321
- phantom : PhantomData < RcBox < T > > ,
321
+ phantom : PhantomData < Box < RcBox < T > > > ,
322
322
alloc : A ,
323
323
}
324
324
@@ -3400,7 +3400,7 @@ fn data_offset_align(align: usize) -> usize {
3400
3400
#[ derive( Debug ) ]
3401
3401
pub struct UniqueRc < T > {
3402
3402
ptr : NonNull < RcBox < T > > ,
3403
- phantom : PhantomData < RcBox < T > > ,
3403
+ phantom : PhantomData < Box < RcBox < T > > > ,
3404
3404
}
3405
3405
3406
3406
impl < T > UniqueRc < T > {
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ pub struct Arc<
251
251
#[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
252
252
> {
253
253
ptr : NonNull < ArcInner < T > > ,
254
- phantom : PhantomData < ArcInner < T > > ,
254
+ phantom : PhantomData < Box < ArcInner < T > > > ,
255
255
alloc : A ,
256
256
}
257
257
Original file line number Diff line number Diff line change 1
1
use crate :: convert:: From ;
2
2
use crate :: fmt;
3
- use crate :: marker:: { PhantomData , Unsize } ;
3
+ use crate :: marker:: { Freeze , PhantomData , Unsize } ;
4
4
use crate :: ops:: { CoerceUnsized , DispatchFromDyn } ;
5
5
use crate :: ptr:: NonNull ;
6
6
@@ -58,6 +58,10 @@ unsafe impl<T: Send + ?Sized> Send for Unique<T> {}
58
58
#[ unstable( feature = "ptr_internals" , issue = "none" ) ]
59
59
unsafe impl < T : Sync + ?Sized > Sync for Unique < T > { }
60
60
61
+ /// `Unique` pointers are always `Freeze` since any interior mutability that might exist in `T` is
62
+ /// masked by the pointer indirection.
63
+ unsafe impl < T : ?Sized > Freeze for Unique < T > { }
64
+
61
65
#[ unstable( feature = "ptr_internals" , issue = "none" ) ]
62
66
impl < T : Sized > Unique < T > {
63
67
/// Creates a new `Unique` that is dangling, but well-aligned.
You can’t perform that action at this time.
0 commit comments