We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 608e57c commit 46e935dCopy full SHA for 46e935d
src/test/run-pass/enum-discrim-manual-sizing-2.rs
@@ -11,7 +11,7 @@
11
// Test that explicit discriminant sizing inhibits the non-nullable pointer
12
// optimization in enum layout.
13
14
-use std::mem::size_of;
+use std::mem::{size_of, zeroed};
15
16
#[repr(i8)]
17
enum Ei8<T> {
@@ -103,4 +103,10 @@ pub fn main() {
103
assert!(size_of::<Euint<&i32>>() > size_of::<usize>());
104
105
assert!(size_of::<EC<&i32>>() > size_of::<EC<()>>());
106
+
107
+ let zero: &i32 = unsafe { zeroed() };
108
+ assert!(match Eu8::_Some(zero) {
109
+ Eu8::_Some(_) => true,
110
+ Eu8::_None => false,
111
+ });
112
}
0 commit comments