diff --git a/src/array_string.rs b/src/array_string.rs index 0dc0974..6cd1c65 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -26,6 +26,7 @@ use serde::{Serialize, Deserialize, Serializer, Deserializer}; /// if needed. #[derive(Copy)] pub struct ArrayString> { + // FIXME: Use Copyable union for xs when we can xs: A, len: A::Index, } @@ -53,7 +54,8 @@ impl> ArrayString { pub fn new() -> ArrayString { unsafe { ArrayString { - xs: ::new_array(), + // FIXME: Use Copyable union for xs when we can + xs: mem::zeroed(), len: Index::from(0), } } diff --git a/src/lib.rs b/src/lib.rs index 9579114..cd8f0b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,14 +74,6 @@ pub use array_string::ArrayString; pub use errors::CapacityError; -unsafe fn new_array() -> A { - // Note: Returning an uninitialized value here only works - // if we can be sure the data is never used. The nullable pointer - // inside enum optimization conflicts with this this for example, - // so we need to be extra careful. See `NoDrop` enum. - mem::uninitialized() -} - /// A vector with a fixed capacity. /// /// The `ArrayVec` is a vector backed by a fixed size array. It keeps track of