rust/tests/ui/uninhabited/uninhabited-irrefutable.rs

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

31 lines
512 B
Rust
Raw Normal View History

#![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, u32),
}
fn main() {
let x: Foo = Foo::D(123, 456);
2022-12-23 14:02:23 -06:00
let Foo::D(_y, _z) = x;
//~^ ERROR refutable pattern in local binding
//~| `Foo::A(_)` not covered
}