We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
MaybeUninit
minicore
1 parent ec2d669 commit aa38b7fCopy full SHA for aa38b7f
1 file changed
tests/auxiliary/minicore.rs
@@ -27,6 +27,7 @@
27
decl_macro,
28
f16,
29
f128,
30
+ transparent_unions,
31
asm_experimental_arch,
32
unboxed_closures
33
)]
@@ -127,6 +128,25 @@ pub struct ManuallyDrop<T: PointeeSized> {
127
128
}
129
impl<T: Copy + PointeeSized> Copy for ManuallyDrop<T> {}
130
131
+#[lang = "maybe_uninit"]
132
+#[repr(transparent)]
133
+pub union MaybeUninit<T> {
134
+ uninit: (),
135
+ value: ManuallyDrop<T>,
136
+}
137
+
138
+impl<T: Copy + PointeeSized> Copy for MaybeUninit<T> {}
139
140
+impl<T> MaybeUninit<T> {
141
+ pub const fn uninit() -> Self {
142
+ Self { uninit: () }
143
+ }
144
145
+ pub const fn new(value: T) -> Self {
146
+ Self { value: ManuallyDrop { value } }
147
148
149
150
#[repr(transparent)]
151
#[rustc_nonnull_optimization_guaranteed]
152
pub struct NonNull<T: ?Sized> {
0 commit comments