rust/tests/ui/consts/ice-48279.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
519 B
Rust
Raw Normal View History

//@ run-pass
#![allow(dead_code)]
#![allow(unused_unsafe)]
2018-02-19 09:26:53 +00:00
// https://github.com/rust-lang/rust/issues/48279
#[derive(PartialEq, Eq)]
pub struct NonZeroU32 {
value: u32
}
impl NonZeroU32 {
const unsafe fn new_unchecked(value: u32) -> Self {
NonZeroU32 { value }
}
}
2024-02-22 13:59:52 +00:00
// pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) };
2018-02-19 09:26:53 +00:00
pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } };
fn main() {
match None {
Some(FOO_ATOM) => {}
_ => {}
}
}