2019-12-11 09:51:28 -05:00
|
|
|
#![feature(never_type)]
|
2018-01-21 16:44:41 +08:00
|
|
|
#![feature(exhaustive_patterns)]
|
2016-12-01 11:37:03 +08:00
|
|
|
|
|
|
|
mod foo {
|
|
|
|
pub struct SecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct NotSoSecretlyEmpty {
|
|
|
|
pub _pub: !,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NotSoSecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Foo {
|
2023-04-09 08:09:43 +00:00
|
|
|
//~^ NOTE `Foo` defined here
|
2016-12-01 11:37:03 +08:00
|
|
|
A(foo::SecretlyEmpty),
|
2023-04-09 08:09:43 +00:00
|
|
|
//~^ NOTE not covered
|
2016-12-01 11:37:03 +08:00
|
|
|
B(foo::NotSoSecretlyEmpty),
|
|
|
|
C(NotSoSecretlyEmpty),
|
2022-03-08 05:54:38 +00:00
|
|
|
D(u32, u32),
|
2016-12-01 11:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2022-03-08 05:54:38 +00:00
|
|
|
let x: Foo = Foo::D(123, 456);
|
2022-12-23 21:02:23 +01:00
|
|
|
let Foo::D(_y, _z) = x;
|
|
|
|
//~^ ERROR refutable pattern in local binding
|
|
|
|
//~| `Foo::A(_)` not covered
|
2023-04-09 08:09:43 +00:00
|
|
|
//~| NOTE `let` bindings require an "irrefutable pattern"
|
|
|
|
//~| NOTE for more information
|
|
|
|
//~| NOTE pattern `Foo::A(_)` is currently uninhabited
|
|
|
|
//~| NOTE the matched value is of type `Foo`
|
|
|
|
//~| HELP you might want to use `let else`
|
2016-12-01 11:37:03 +08:00
|
|
|
}
|