1 macro_rules! foo {
2 ($a:ident) => ();
3 ($a:ident, $b:ident) => ();
4 ($a:ident, $b:ident, $c:ident) => ();
5 ($a:ident, $b:ident, $c:ident, $d:ident) => ();
6 ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
7 }
8
9 macro_rules! bar {
10 ($lvl:expr, $($arg:tt)+) => {}
11 }
12
13 macro_rules! check {
14 ($ty:ty, $expected:expr) => {};
15 ($ty_of:expr, $expected:expr) => {};
16 }
17
main()18 fn main() {
19 println!("{}" a);
20 //~^ ERROR expected `,`, found `a`
21 foo!(a b);
22 //~^ ERROR no rules expected the token `b`
23 foo!(a, b, c, d e);
24 //~^ ERROR no rules expected the token `e`
25 foo!(a, b, c d, e);
26 //~^ ERROR no rules expected the token `d`
27 foo!(a, b, c d e);
28 //~^ ERROR no rules expected the token `d`
29 bar!(Level::Error, );
30 //~^ ERROR unexpected end of macro invocation
31 check!(<str as Debug>::fmt, "fmt");
32 check!(<str as Debug>::fmt, "fmt",);
33 //~^ ERROR no rules expected the token `,`
34 }
35