rust/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs
2024-09-18 19:17:38 -04:00

17 lines
291 B
Rust

// Make sure we consider `!` to be a union read.
#![feature(never_type, never_patterns)]
//~^ WARN the feature `never_patterns` is incomplete
union U {
a: !,
b: usize,
}
fn foo<T>(u: U) -> ! {
let U { a: ! } = u;
//~^ ERROR access to union field is unsafe
}
fn main() {}