rust/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs

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

33 lines
860 B
Rust
Raw Normal View History

//@ check-fail
#![deny(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
#![allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
fn main() {
enum Foo {
2023-10-14 08:19:51 -05:00
A,
B,
C,
}
#[allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
//~^ ERROR non-exhaustive patterns: `Foo::C` not covered
Foo::A => {}
Foo::B => {}
}
2023-10-14 08:19:51 -05:00
#[warn(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
Foo::A => {}
Foo::B => {}
_ => {}
}
}