2 #![allow(unused_macros)]
3 macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
4 macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
5 macro_rules! qux { ($x:pat, $y:pat) => {} } // should be ok
6 macro_rules! match_any {
7 ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { //~ ERROR `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments
10 $( $pat => $expr_arm, )+
17 let result: Result<i64, i32> = Err(42);
18 let int: i64 = match_any!(result, Ok(i) | Err(i) => i.into());