diff options
Diffstat (limited to 'src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs')
-rw-r--r-- | src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs new file mode 100644 index 000000000..29a6e1f8a --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs @@ -0,0 +1,34 @@ +// check-fail + +#![deny(non_exhaustive_omitted_patterns)] +//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns` +//~| WARNING unknown lint: `non_exhaustive_omitted_patterns` +#![allow(non_exhaustive_omitted_patterns)] +//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns` +//~| WARNING unknown lint: `non_exhaustive_omitted_patterns` + +fn main() { + enum Foo { + A, B, C, + } + + #[allow(non_exhaustive_omitted_patterns)] + //~^ WARNING unknown lint: `non_exhaustive_omitted_patterns` + //~| WARNING unknown lint: `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 => {} + } + //~^^^^ ERROR non-exhaustive patterns: `C` not covered + + match Foo::A { + Foo::A => {} + Foo::B => {} + #[warn(non_exhaustive_omitted_patterns)] + _ => {} + } + //~^^^ WARNING unknown lint: `non_exhaustive_omitted_patterns` + //~| WARNING unknown lint: `non_exhaustive_omitted_patterns` +} |