File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 2626 decl_macro,
2727 f16,
2828 f128,
29+ transparent_unions,
2930 asm_experimental_arch,
3031 unboxed_closures
3132) ]
@@ -119,6 +120,25 @@ pub struct ManuallyDrop<T: PointeeSized> {
119120}
120121impl < T : Copy + PointeeSized > Copy for ManuallyDrop < T > { }
121122
123+ #[ lang = "maybe_uninit" ]
124+ #[ repr( transparent) ]
125+ pub union MaybeUninit < T > {
126+ uninit : ( ) ,
127+ value : ManuallyDrop < T > ,
128+ }
129+
130+ impl < T : Copy + PointeeSized > Copy for MaybeUninit < T > { }
131+
132+ impl < T > MaybeUninit < T > {
133+ pub const fn uninit ( ) -> Self {
134+ Self { uninit : ( ) }
135+ }
136+
137+ pub const fn new ( value : T ) -> Self {
138+ Self { value : ManuallyDrop { value } }
139+ }
140+ }
141+
122142#[ lang = "unsafe_cell" ]
123143#[ repr( transparent) ]
124144pub struct UnsafeCell < T : PointeeSized > {
You can’t perform that action at this time.
0 commit comments