summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros/issue-61053-different-kleene.rs
blob: 9b7babdbb70adaa6cf1a496ad1bcd5aec9180d38 (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
26
27
28
29
30
#![deny(meta_variable_misuse)]

macro_rules! foo {
    () => {};
    ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* };
    //~^ ERROR meta-variable repeats with
    ( $( $($j:ident),+ );* ) => { $( $( $j; )+ )+ }; //~ERROR meta-variable repeats with
}

macro_rules! bar {
    () => {};
    (test) => {
        macro_rules! nested {
            () => {};
            ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* };
            //~^ ERROR meta-variable repeats with
            ( $( $($j:ident),+ );* ) => { $( $( $j; )+ )+ }; //~ERROR meta-variable repeats with
        }
    };
    ( $( $i:ident = $($j:ident),+ );* ) => {
        $(macro_rules! $i {
            () => { 0 $( + $j )* }; //~ ERROR meta-variable repeats with
        })*
    };
}

fn main() {
    foo!();
    bar!();
}