2022-02-28 20:29:06 +00:00
|
|
|
// check-fail
|
|
|
|
|
2021-10-01 14:21:56 +00:00
|
|
|
#![deny(non_exhaustive_omitted_patterns)]
|
2022-02-28 20:29:06 +00:00
|
|
|
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
2021-10-01 14:21:56 +00:00
|
|
|
#![allow(non_exhaustive_omitted_patterns)]
|
2022-02-28 20:29:06 +00:00
|
|
|
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
2021-10-01 14:21:56 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
enum Foo {
|
2023-10-14 13:19:51 +00:00
|
|
|
A,
|
|
|
|
B,
|
|
|
|
C,
|
2021-10-01 14:21:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(non_exhaustive_omitted_patterns)]
|
2022-02-28 20:29:06 +00:00
|
|
|
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
|
|
|
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
2021-10-01 14:21:56 +00:00
|
|
|
match Foo::A {
|
2023-10-14 16:25:10 +00:00
|
|
|
//~^ ERROR non-exhaustive patterns: `Foo::C` not covered
|
2021-10-01 14:21:56 +00:00
|
|
|
Foo::A => {}
|
|
|
|
Foo::B => {}
|
|
|
|
}
|
|
|
|
|
2023-10-14 13:19:51 +00:00
|
|
|
#[warn(non_exhaustive_omitted_patterns)]
|
|
|
|
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
|
|
|
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
|
2021-10-01 14:21:56 +00:00
|
|
|
match Foo::A {
|
|
|
|
Foo::A => {}
|
|
|
|
Foo::B => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|