1 #![allow(unused_macros)]
3 // Tests that repetition matchers cannot match the empty token tree (since that would be
10 //~^ ERROR repetition matches empty token tree
12 //~^ ERROR repetition matches empty token tree
14 //~^ ERROR repetition matches empty token tree
15 ( $(),* ) => {}; // PASS
16 ( $(),+ ) => {}; // PASS
17 // `?` cannot have a separator...
19 //~^ ERROR repetition matches empty token tree
21 //~^ ERROR repetition matches empty token tree
23 //~^ ERROR repetition matches empty token tree
24 ( [$(),*] ) => {}; // PASS
25 ( [$(),+] ) => {}; // PASS
26 // `?` cannot have a separator...
27 ( $($()* $(),* $(a)* $(a),* )* ) => {};
28 //~^ ERROR repetition matches empty token tree
29 ( $($()* $(),* $(a)* $(a),* )+ ) => {};
30 //~^ ERROR repetition matches empty token tree
31 ( $($()* $(),* $(a)* $(a),* )? ) => {};
32 //~^ ERROR repetition matches empty token tree
33 ( $($()? $(),* $(a)? $(a),* )* ) => {};
34 //~^ ERROR repetition matches empty token tree
35 ( $($()? $(),* $(a)? $(a),* )+ ) => {};
36 //~^ ERROR repetition matches empty token tree
37 ( $($()? $(),* $(a)? $(a),* )? ) => {};
38 //~^ ERROR repetition matches empty token tree
39 ( $(a $(),* $(a)* $(a),* )* ) => {}; // PASS
40 ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS
41 ( $($(a)+ $(),* $(a)* $(a),* )? ) => {}; // PASS
43 ( $(a $(),* $(a)? $(a),* )* ) => {}; // PASS
44 ( $($(a)+ $(),* $(a)? $(a),* )+ ) => {}; // PASS
45 ( $($(a)+ $(),* $(a)? $(a),* )? ) => {}; // PASS
48 //~^ ERROR repetition matches empty token tree
50 //~^ ERROR repetition matches empty token tree
52 //~^ ERROR repetition matches empty token tree
54 //~^ ERROR repetition matches empty token tree
57 // --- Original Issue --- //
59 macro_rules! make_vec {
60 (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
61 //~^ ERROR repetition matches empty token tree
65 let _ = make_vec![a 1, a 2, a 3];
68 // --- Minified Issue --- //
72 //~^ ERROR repetition matches empty token tree