@@ -956,7 +956,7 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
956
956
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
957
957
#[ lang = "manually_drop" ]
958
958
#[ derive( Copy , Clone , Debug , Default , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
959
- pub struct ManuallyDrop < T > {
959
+ pub struct ManuallyDrop < T : ? Sized > {
960
960
value : T ,
961
961
}
962
962
@@ -990,7 +990,9 @@ impl<T> ManuallyDrop<T> {
990
990
pub fn into_inner ( slot : ManuallyDrop < T > ) -> T {
991
991
slot. value
992
992
}
993
+ }
993
994
995
+ impl < T : ?Sized > ManuallyDrop < T > {
994
996
/// Manually drops the contained value.
995
997
///
996
998
/// # Safety
@@ -1006,7 +1008,7 @@ impl<T> ManuallyDrop<T> {
1006
1008
}
1007
1009
1008
1010
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
1009
- impl < T > Deref for ManuallyDrop < T > {
1011
+ impl < T : ? Sized > Deref for ManuallyDrop < T > {
1010
1012
type Target = T ;
1011
1013
#[ inline]
1012
1014
fn deref ( & self ) -> & Self :: Target {
@@ -1015,13 +1017,16 @@ impl<T> Deref for ManuallyDrop<T> {
1015
1017
}
1016
1018
1017
1019
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
1018
- impl < T > DerefMut for ManuallyDrop < T > {
1020
+ impl < T : ? Sized > DerefMut for ManuallyDrop < T > {
1019
1021
#[ inline]
1020
1022
fn deref_mut ( & mut self ) -> & mut Self :: Target {
1021
1023
& mut self . value
1022
1024
}
1023
1025
}
1024
1026
1027
+ #[ unstable( feature = "coerce_unsized" , issue = "27732" ) ]
1028
+ impl < T : CoerceUnsized < U > , U > CoerceUnsized < ManuallyDrop < U > > for ManuallyDrop < T > { }
1029
+
1025
1030
/// A pinned reference.
1026
1031
///
1027
1032
/// A pinned reference is a lot like a mutable reference, except that it is not
0 commit comments