Closed
Description
Initially in an ArrayVec
the memory is uninitialized: https://github.com/bluss/arrayvec/blob/master/src/lib.rs#L80.
This simply is UB in Rust for any types with invalid bit patterns (most notably references). Just creating an uninitialized value with these bit patterns is UB.
Even perfectly fine code that never actually reads or uses the uninitialized memory still has undefined behavior. I ran into this myself: https://stackoverflow.com/questions/52348277/vector-is-empty-after-cloning-struct-with-uninitialized-member.