File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1106,12 +1106,22 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
1106
1106
// FIXME before stabilizing, explain how to initialize a struct field-by-field.
1107
1107
#[ allow( missing_debug_implementations) ]
1108
1108
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1109
+ #[ derive( Copy ) ]
1109
1110
// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized`
1110
1111
pub union MaybeUninit < T > {
1111
1112
uninit : ( ) ,
1112
1113
value : ManuallyDrop < T > ,
1113
1114
}
1114
1115
1116
+ #[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1117
+ impl < T : Copy > Clone for MaybeUninit < T > {
1118
+ #[ inline( always) ]
1119
+ fn clone ( & self ) -> Self {
1120
+ // Not calling T::clone(), we cannot know if we are initialized enough for that.
1121
+ * self
1122
+ }
1123
+ }
1124
+
1115
1125
impl < T > MaybeUninit < T > {
1116
1126
/// Create a new `MaybeUninit` initialized with the given value.
1117
1127
///
You can’t perform that action at this time.
0 commit comments