]> git.proxmox.com Git - rustc.git/blame - src/test/ui/macros/missing-comma.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / macros / missing-comma.rs
CommitLineData
b7449926
XL
1macro_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
532ac7d7
XL
9macro_rules! bar {
10 ($lvl:expr, $($arg:tt)+) => {}
11}
12
48663c56
XL
13macro_rules! check {
14 ($ty:ty, $expected:expr) => {};
15 ($ty_of:expr, $expected:expr) => {};
16}
532ac7d7 17
b7449926
XL
18fn main() {
19 println!("{}" a);
1b1a35ee 20 //~^ ERROR expected `,`, found `a`
b7449926
XL
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`
532ac7d7
XL
29 bar!(Level::Error, );
30 //~^ ERROR unexpected end of macro invocation
48663c56
XL
31 check!(<str as Debug>::fmt, "fmt");
32 check!(<str as Debug>::fmt, "fmt",);
33 //~^ ERROR no rules expected the token `,`
b7449926 34}