Skip to content

Commit 8b29c62

Browse files
committed
Add a test for #[repr] as used in arrayvec
1 parent 608e57c commit 8b29c62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/run-pass/enum-discrim-manual-sizing-2.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test that explicit discriminant sizing inhibits the non-nullable pointer
1212
// optimization in enum layout.
1313

14-
use std::mem::size_of;
14+
use std::mem::{size_of, zeroed};
1515

1616
#[repr(i8)]
1717
enum Ei8<T> {
@@ -103,4 +103,10 @@ pub fn main() {
103103
assert!(size_of::<Euint<&i32>>() > size_of::<usize>());
104104

105105
assert!(size_of::<EC<&i32>>() > size_of::<EC<()>>());
106+
107+
let zero: &i32 = unsafe { zeroed() };
108+
assert!(Eu8::_Some(zero) {
109+
Eu8::_Some(_) => true,
110+
Eu8::_None => false,
111+
});
106112
}

0 commit comments

Comments
 (0)