]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
Rollup merge of #94689 - compiler-errors:on-unimplemented-substs, r=petrochenkov
[rust.git] / src / test / ui / rfc-2008-non-exhaustive / stable-omitted-patterns.rs
1 // Test that the `non_exhaustive_omitted_patterns` lint is triggered correctly with variants
2 // marked stable and unstable.
3
4 #![feature(non_exhaustive_omitted_patterns_lint)]
5
6 // aux-build:unstable.rs
7 extern crate unstable;
8
9 use unstable::{UnstableEnum, OnlyUnstableEnum};
10
11 fn main() {
12     // OK: this matches all the stable variants
13     match UnstableEnum::Stable {
14         UnstableEnum::Stable => {}
15         UnstableEnum::Stable2 => {}
16         #[deny(non_exhaustive_omitted_patterns)]
17         _ => {}
18     }
19
20     match UnstableEnum::Stable {
21         UnstableEnum::Stable => {}
22         #[deny(non_exhaustive_omitted_patterns)]
23         _ => {}
24     }
25     //~^^ some variants are not matched explicitly
26
27     // Ok: although this is a bit odd, we don't have anything to report
28     // since there is no stable variants and the feature is off
29     #[deny(non_exhaustive_omitted_patterns)]
30     match OnlyUnstableEnum::new() {
31         _ => {}
32     }
33 }