File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 82
82
#![ feature( const_fn) ]
83
83
#![ feature( const_int_ops) ]
84
84
#![ feature( const_fn_union) ]
85
+ #![ feature( const_manually_drop_new) ]
85
86
#![ feature( custom_attribute) ]
86
87
#![ feature( doc_cfg) ]
87
88
#![ feature( doc_spotlight) ]
Original file line number Diff line number Diff line change @@ -1021,6 +1021,15 @@ pub union MaybeUninit<T> {
1021
1021
}
1022
1022
1023
1023
impl < T > MaybeUninit < T > {
1024
+ /// Create a new `MaybeUninit` initialized with the given value.
1025
+ ///
1026
+ /// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1027
+ /// It is your responsibility to make sure `T` gets dropped if it got initialized.
1028
+ #[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1029
+ pub const fn new ( val : T ) -> MaybeUninit < T > {
1030
+ MaybeUninit { value : ManuallyDrop :: new ( val) }
1031
+ }
1032
+
1024
1033
/// Create a new `MaybeUninit` in an uninitialized state.
1025
1034
///
1026
1035
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
You can’t perform that action at this time.
0 commit comments