File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ pub struct Rc<
318318 #[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
319319> {
320320 ptr : NonNull < RcBox < T > > ,
321- phantom : PhantomData < RcBox < T > > ,
321+ phantom : PhantomData < Box < RcBox < T > > > ,
322322 alloc : A ,
323323}
324324
@@ -3400,7 +3400,7 @@ fn data_offset_align(align: usize) -> usize {
34003400#[ derive( Debug ) ]
34013401pub struct UniqueRc < T > {
34023402 ptr : NonNull < RcBox < T > > ,
3403- phantom : PhantomData < RcBox < T > > ,
3403+ phantom : PhantomData < Box < RcBox < T > > > ,
34043404}
34053405
34063406impl < T > UniqueRc < T > {
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ pub struct Arc<
251251 #[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
252252> {
253253 ptr : NonNull < ArcInner < T > > ,
254- phantom : PhantomData < ArcInner < T > > ,
254+ phantom : PhantomData < Box < ArcInner < T > > > ,
255255 alloc : A ,
256256}
257257
Original file line number Diff line number Diff line change 11use crate :: convert:: From ;
22use crate :: fmt;
3- use crate :: marker:: { PhantomData , Unsize } ;
3+ use crate :: marker:: { Freeze , PhantomData , Unsize } ;
44use crate :: ops:: { CoerceUnsized , DispatchFromDyn } ;
55use crate :: ptr:: NonNull ;
66
@@ -58,6 +58,10 @@ unsafe impl<T: Send + ?Sized> Send for Unique<T> {}
5858#[ unstable( feature = "ptr_internals" , issue = "none" ) ]
5959unsafe impl < T : Sync + ?Sized > Sync for Unique < T > { }
6060
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+
6165#[ unstable( feature = "ptr_internals" , issue = "none" ) ]
6266impl < T : Sized > Unique < T > {
6367 /// Creates a new `Unique` that is dangling, but well-aligned.
You can’t perform that action at this time.
0 commit comments