summary refs log tree commit diff
path: root/src/test/ui/macros/macro-multiple-matcher-bindings.rs
blob: 9e0fa3887163d0d9d8c8ae604dcd778b479b23d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Test that duplicate matcher binding names are caught at declaration time, rather than at macro
// invocation time.
//
// FIXME(mark-i-m): Update this when it becomes a hard error.

// compile-pass

#![allow(unused_macros)]

macro_rules! foo1 {
    ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding
    ($a:ident, $a:path) => {};  //~WARNING duplicate matcher binding
}

macro_rules! foo2 {
    ($a:ident) => {}; // OK
    ($a:path) => {};  // OK
}

macro_rules! foo3 {
    ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding
    ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding
}

fn main() {}