]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/usefulness/issue-80501-or-pat-and-macro.rs
Add tests
[rust.git] / src / test / ui / pattern / usefulness / issue-80501-or-pat-and-macro.rs
1 #![deny(unreachable_patterns)]
2 //~^ NOTE: lint level is defined here
3 pub enum TypeCtor {
4     Slice,
5     Array,
6 }
7
8 pub struct ApplicationTy(TypeCtor);
9
10 macro_rules! ty_app {
11     ($ctor:pat) => {
12         ApplicationTy($ctor) //~ ERROR unreachable pattern
13     };
14 }
15
16 fn _foo(ty: ApplicationTy) {
17     match ty {
18         ty_app!(TypeCtor::Array) | ty_app!(TypeCtor::Slice) => {} //~ NOTE: in this expansion
19     }
20
21     // same as above, with the macro expanded
22     match ty {
23         ApplicationTy(TypeCtor::Array) | ApplicationTy(TypeCtor::Slice) => {}
24     }
25 }
26
27 fn main() {}