@@ -23,5 +23,93 @@ LL | complex_nonterminal!(enum E {});
2323 = help: try using `:tt` instead in the macro definition
2424 = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
2525
26- error: aborting due to 1 previous error
26+ error: no rules expected the token `3`
27+ --> $DIR/nonterminal-matching.rs:32:35
28+ |
29+ LL | (expr $x:expr) => { bar!(expr $x); };
30+ | ^^ no rules expected this token in macro call
31+ ...
32+ LL | macro_rules! bar {
33+ | ---------------- when calling this macro
34+ ...
35+ LL | foo!(expr 3);
36+ | ------------ in this macro invocation
37+ |
38+ note: while trying to match `3`
39+ --> $DIR/nonterminal-matching.rs:42:11
40+ |
41+ LL | (expr 3) => {};
42+ | ^
43+ = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
44+ = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
45+ = help: try using `:tt` instead in the macro definition
46+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
47+
48+ error: no rules expected the token `4`
49+ --> $DIR/nonterminal-matching.rs:33:44
50+ |
51+ LL | (literal $x:literal) => { bar!(literal $x); };
52+ | ^^ no rules expected this token in macro call
53+ ...
54+ LL | macro_rules! bar {
55+ | ---------------- when calling this macro
56+ ...
57+ LL | foo!(literal 4);
58+ | --------------- in this macro invocation
59+ |
60+ note: while trying to match `4`
61+ --> $DIR/nonterminal-matching.rs:43:14
62+ |
63+ LL | (literal 4) => {};
64+ | ^
65+ = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
66+ = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
67+ = help: try using `:tt` instead in the macro definition
68+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
69+
70+ error: no rules expected the token `a::b::c`
71+ --> $DIR/nonterminal-matching.rs:34:35
72+ |
73+ LL | (path $x:path) => { bar!(path $x); };
74+ | ^^ no rules expected this token in macro call
75+ ...
76+ LL | macro_rules! bar {
77+ | ---------------- when calling this macro
78+ ...
79+ LL | foo!(path a::b::c);
80+ | ------------------ in this macro invocation
81+ |
82+ note: while trying to match `a`
83+ --> $DIR/nonterminal-matching.rs:44:11
84+ |
85+ LL | (path a::b::c) => {};
86+ | ^
87+ = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
88+ = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
89+ = help: try using `:tt` instead in the macro definition
90+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
91+
92+ error: no rules expected the token `let abc = 0`
93+ --> $DIR/nonterminal-matching.rs:35:35
94+ |
95+ LL | (stmt $x:stmt) => { bar!(stmt $x); };
96+ | ^^ no rules expected this token in macro call
97+ ...
98+ LL | macro_rules! bar {
99+ | ---------------- when calling this macro
100+ ...
101+ LL | foo!(stmt let abc = 0);
102+ | ---------------------- in this macro invocation
103+ |
104+ note: while trying to match `let`
105+ --> $DIR/nonterminal-matching.rs:45:11
106+ |
107+ LL | (stmt let abc = 0) => {};
108+ | ^^^
109+ = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
110+ = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
111+ = help: try using `:tt` instead in the macro definition
112+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
113+
114+ error: aborting due to 5 previous errors
27115
0 commit comments