File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ use crate::types::ForeignOwnable;
6565/// `self.0` is always properly aligned and either points to memory allocated with `A` or, for
6666/// zero-sized types, is a dangling, well aligned pointer.
6767#[ repr( transparent) ]
68- pub struct Box < T : ?Sized , A : Allocator > ( NonNull < T > , PhantomData < A > ) ;
68+ #[ cfg_attr( CONFIG_RUSTC_HAS_COERCE_POINTEE , derive( core:: marker:: CoercePointee ) ) ]
69+ pub struct Box < #[ pointee] T : ?Sized , A : Allocator > ( NonNull < T > , PhantomData < A > ) ;
6970
7071/// Type alias for [`Box`] with a [`Kmalloc`] allocator.
7172///
Original file line number Diff line number Diff line change 1515#![ feature( arbitrary_self_types) ]
1616#![ feature( associated_type_defaults) ]
1717#![ cfg_attr( CONFIG_RUSTC_HAS_COERCE_POINTEE , feature( derive_coerce_pointee) ) ]
18+ #![ cfg_attr( CONFIG_RUSTC_HAS_COERCE_POINTEE , feature( pin_coerce_unsized_trait) ) ]
1819#![ cfg_attr( not( CONFIG_RUSTC_HAS_COERCE_POINTEE ) , feature( coerce_unsized) ) ]
1920#![ cfg_attr( not( CONFIG_RUSTC_HAS_COERCE_POINTEE ) , feature( dispatch_from_dyn) ) ]
2021#![ cfg_attr( not( CONFIG_RUSTC_HAS_COERCE_POINTEE ) , feature( unsize) ) ]
Original file line number Diff line number Diff line change @@ -199,6 +199,11 @@ impl<T: ?Sized> ArcInner<T> {
199199#[ cfg( not( CONFIG_RUSTC_HAS_COERCE_POINTEE ) ) ]
200200impl < T : ?Sized + core:: marker:: Unsize < U > , U : ?Sized > core:: ops:: CoerceUnsized < Arc < U > > for Arc < T > { }
201201
202+ // This is to allow coercion from `Arc<T>` to `Arc<U>` if `T` can be converted to the
203+ // dynamically-sized type (DST) `U`.
204+ #[ cfg( CONFIG_RUSTC_HAS_COERCE_POINTEE ) ]
205+ unsafe impl < T : ?Sized > core:: pin:: PinCoerceUnsized for Arc < T > { }
206+
202207// This is to allow `Arc<U>` to be dispatched on when `Arc<T>` can be coerced into `Arc<U>`.
203208#[ cfg( not( CONFIG_RUSTC_HAS_COERCE_POINTEE ) ) ]
204209impl < T : ?Sized + core:: marker:: Unsize < U > , U : ?Sized > core:: ops:: DispatchFromDyn < Arc < U > > for Arc < T > { }
You can’t perform that action at this time.
0 commit comments