]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/usefulness/issue-80501-or-pat-and-macro.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / pattern / usefulness / issue-80501-or-pat-and-macro.rs
1 // check-pass
2 #![deny(unreachable_patterns)]
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)
13 };
14 }
15
16 fn _foo(ty: ApplicationTy) {
17 match ty {
18 ty_app!(TypeCtor::Array) | ty_app!(TypeCtor::Slice) => {}
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() {}