Closed
Description
This currently fails:
assert!(Some(SmallVec4::<&u32>::new()).is_some());
This is because SmallVec<&u32>
contains a [&u32; 4]
field directly, and the compiler choses to use one of those &u32
(which are non-zero) to set to zero to represent None
in Option<SmallVec<&u32>>
. However, new
initializes the array with std::mem::zeroed()
, which conflicts with this optimization.
https://github.com/bluss/arrayvec works around this by using #[repr(u8)]
on an enum
. (The one used to make drop
sound, see #4.)
CC @pcwalton
Metadata
Metadata
Assignees
Labels
No labels