]> git.lizzy.rs Git - rust.git/blob - src/test/ui/enum-discriminant/niche-prefer-zero.rs
Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
[rust.git] / src / test / ui / enum-discriminant / niche-prefer-zero.rs
1 // Check that niche selection prefers zero.
2 // See https://github.com/rust-lang/rust/pull/87794
3 // run-pass
4 #[repr(u8)]
5 pub enum Size {
6     One = 1,
7     Two = 2,
8     Three = 3,
9 }
10
11 fn main() {
12     // check that `None` is zero
13     assert_eq!(0, unsafe { std::mem::transmute::<Option<Size>, u8>(None) });
14 }