* '0.4' of https://github.com/bluss/arrayvec:
  0.4.10
  FIX: Remove unused Copy/Clone for MaybeUninit
  FIX: Use repr(C) MaybeUninit after discussion with RalfJung
This commit is contained in:
bluss
2018-12-22 20:05:42 +01:00
3 changed files with 7 additions and 7 deletions
+1 -6
View File
@@ -6,18 +6,13 @@ use std::mem::ManuallyDrop;
/// A combination of ManuallyDrop and “maybe uninitialized”;
/// this wraps a value that can be wholly or partially uninitialized;
/// it also has no drop regardless of the type of T.
#[derive(Copy)]
#[repr(C)] // for cast from self ptr to value
pub union MaybeUninit<T> {
empty: (),
value: ManuallyDrop<T>,
}
// Why we don't use std's MaybeUninit on nightly? See the ptr method
impl<T> Clone for MaybeUninit<T> where T: Copy
{
fn clone(&self) -> Self { *self }
}
impl<T> MaybeUninit<T> {
/// Create a new MaybeUninit with uninitialized interior
pub unsafe fn uninitialized() -> Self {