FIX: Remove use of uninitialized in ArrayString
We can't fix this properly (MaybeUninit with a union) until we change the user visible API (we need to require that A: Copy. As a temporary solution for arrayvec version 0.4.*, we use zeroed to initialize an array of bytes, instead of using uninitialized. This may have a negative performance impact, but the fix is to upgrade to future arrayvec 0.5.
This commit is contained in:
@@ -74,14 +74,6 @@ pub use array_string::ArrayString;
|
||||
pub use errors::CapacityError;
|
||||
|
||||
|
||||
unsafe fn new_array<A: 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
|
||||
|
||||
Reference in New Issue
Block a user