diff --git a/Cargo.toml b/Cargo.toml index 6a45270..026111a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arrayvec" -version = "0.4.9" +version = "0.4.10" authors = ["bluss"] license = "MIT/Apache-2.0" diff --git a/README.rst b/README.rst index 29d3a2f..4af5330 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/src/maybe_uninit.rs b/src/maybe_uninit.rs index 71ec8f0..9ed1f6a 100644 --- a/src/maybe_uninit.rs +++ b/src/maybe_uninit.rs @@ -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 { empty: (), value: ManuallyDrop, } // Why we don't use std's MaybeUninit on nightly? See the ptr method -impl Clone for MaybeUninit where T: Copy -{ - fn clone(&self) -> Self { *self } -} - impl MaybeUninit { /// Create a new MaybeUninit with uninitialized interior pub unsafe fn uninitialized() -> Self {