Merge branch '0.4' of https://github.com/bluss/arrayvec
* '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:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "arrayvec"
|
||||
version = "0.4.9"
|
||||
version = "0.4.10"
|
||||
authors = ["bluss"]
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ __ https://docs.rs/arrayvec
|
||||
Recent Changes (arrayvec)
|
||||
-------------------------
|
||||
|
||||
- 0.4.10
|
||||
|
||||
- Use ``repr(C)`` in the ``union`` version that was introduced in 0.4.9, to
|
||||
allay some soundness concerns.
|
||||
|
||||
- 0.4.9
|
||||
|
||||
- Use ``union`` in the implementation on when this is detected to be supported
|
||||
|
||||
+1
-6
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user