1 // Check that we are refusing to match on complex nonterminals for which tokens are
2 // unavailable and we'd have to go through AST comparisons.
3 
4 #![feature(decl_macro)]
5 
6 macro simple_nonterminal($nt_ident: ident, $nt_lifetime: lifetime, $nt_tt: tt) {
7     macro n(a $nt_ident b $nt_lifetime c $nt_tt d) {
8         struct S;
9     }
10 
11     n!(a $nt_ident b $nt_lifetime c $nt_tt d);
12 }
13 
14 macro complex_nonterminal($nt_item: item) {
15     macro n(a $nt_item b) {
16         struct S;
17     }
18 
19     n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }`
20 }
21 
22 simple_nonterminal!(a, 'a, (x, y, z)); // OK
23 
24 complex_nonterminal!(enum E {});
25 
main()26 fn main() {}
27