2018-08-06 22:54:51 -05:00
|
|
|
macro_rules! foo {
|
2018-08-08 00:28:09 -05:00
|
|
|
($a:ident) => ();
|
|
|
|
($a:ident, $b:ident) => ();
|
|
|
|
($a:ident, $b:ident, $c:ident) => ();
|
|
|
|
($a:ident, $b:ident, $c:ident, $d:ident) => ();
|
|
|
|
($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
|
2018-08-06 22:54:51 -05:00
|
|
|
}
|
|
|
|
|
2019-03-11 17:07:07 -05:00
|
|
|
macro_rules! bar {
|
|
|
|
($lvl:expr, $($arg:tt)+) => {}
|
|
|
|
}
|
|
|
|
|
2019-04-24 18:45:29 -05:00
|
|
|
macro_rules! check {
|
|
|
|
($ty:ty, $expected:expr) => {};
|
|
|
|
($ty_of:expr, $expected:expr) => {};
|
|
|
|
}
|
2019-03-11 17:07:07 -05:00
|
|
|
|
2018-07-15 01:50:08 -05:00
|
|
|
fn main() {
|
|
|
|
println!("{}" a);
|
2020-08-31 04:45:50 -05:00
|
|
|
//~^ ERROR expected `,`, found `a`
|
2018-08-06 22:54:51 -05:00
|
|
|
foo!(a b);
|
|
|
|
//~^ ERROR no rules expected the token `b`
|
2018-08-08 00:28:09 -05:00
|
|
|
foo!(a, b, c, d e);
|
|
|
|
//~^ ERROR no rules expected the token `e`
|
|
|
|
foo!(a, b, c d, e);
|
|
|
|
//~^ ERROR no rules expected the token `d`
|
|
|
|
foo!(a, b, c d e);
|
|
|
|
//~^ ERROR no rules expected the token `d`
|
2019-03-11 17:07:07 -05:00
|
|
|
bar!(Level::Error, );
|
|
|
|
//~^ ERROR unexpected end of macro invocation
|
2019-04-24 18:45:29 -05:00
|
|
|
check!(<str as Debug>::fmt, "fmt");
|
|
|
|
check!(<str as Debug>::fmt, "fmt",);
|
|
|
|
//~^ ERROR no rules expected the token `,`
|
2018-07-15 01:50:08 -05:00
|
|
|
}
|