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