File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 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> {
11061106// FIXME before stabilizing, explain how to initialize a struct field-by-field.
11071107#[ allow( missing_debug_implementations) ]
11081108#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1109+ #[ derive( Copy ) ]
11091110// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized`
11101111pub union MaybeUninit < T > {
11111112 uninit : ( ) ,
11121113 value : ManuallyDrop < T > ,
11131114}
11141115
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+
11151125impl < T > MaybeUninit < T > {
11161126 /// Create a new `MaybeUninit` initialized with the given value.
11171127 ///
You can’t perform that action at this time.
0 commit comments