rust/src/test/ui/uninhabited/uninhabited-irrefutable.rs
2019-12-14 09:01:04 -05:00

29 lines
480 B
Rust

#![feature(never_type)]
#![feature(exhaustive_patterns)]
mod foo {
pub struct SecretlyEmpty {
_priv: !,
}
pub struct NotSoSecretlyEmpty {
pub _pub: !,
}
}
struct NotSoSecretlyEmpty {
_priv: !,
}
enum Foo {
A(foo::SecretlyEmpty),
B(foo::NotSoSecretlyEmpty),
C(NotSoSecretlyEmpty),
D(u32),
}
fn main() {
let x: Foo = Foo::D(123);
let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered
}