]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/ice-48279.rs
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
[rust.git] / tests / ui / consts / ice-48279.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(unused_unsafe)]
4
5 // https://github.com/rust-lang/rust/issues/48279
6
7 #[derive(PartialEq, Eq)]
8 pub struct NonZeroU32 {
9     value: u32
10 }
11
12 impl NonZeroU32 {
13     const unsafe fn new_unchecked(value: u32) -> Self {
14         NonZeroU32 { value }
15     }
16 }
17
18 //pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) };
19 pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } };
20
21 fn main() {
22     match None {
23         Some(FOO_ATOM) => {}
24         _ => {}
25     }
26 }