]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-5067.rs
Auto merge of #57108 - Mark-Simulacrum:license-remove, r=pietroalbini
[rust.git] / src / test / ui / issues / issue-5067.rs
1 #![allow(unused_macros)]
2
3 macro_rules! foo {
4     ( $()* ) => {};
5     //~^ ERROR repetition matches empty token tree
6     ( $()+ ) => {};
7     //~^ ERROR repetition matches empty token tree
8
9     ( $(),* ) => {}; // PASS
10     ( $(),+ ) => {}; // PASS
11
12     ( [$()*] ) => {};
13     //~^ ERROR repetition matches empty token tree
14     ( [$()+] ) => {};
15     //~^ ERROR repetition matches empty token tree
16
17     ( [$(),*] ) => {}; // PASS
18     ( [$(),+] ) => {}; // PASS
19
20     ( $($()* $(),* $(a)* $(a),* )* ) => {};
21     //~^ ERROR repetition matches empty token tree
22     ( $($()* $(),* $(a)* $(a),* )+ ) => {};
23     //~^ ERROR repetition matches empty token tree
24
25     ( $(a     $(),* $(a)* $(a),* )* ) => {}; // PASS
26     ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS
27
28     ( $(a $()+)* ) => {};
29     //~^ ERROR repetition matches empty token tree
30     ( $(a $()*)+ ) => {};
31     //~^ ERROR repetition matches empty token tree
32 }
33
34
35 // --- Original Issue --- //
36
37 macro_rules! make_vec {
38     (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
39     //~^ ERROR repetition matches empty token tree
40 }
41
42 fn main() {
43     let _ = make_vec![a 1, a 2, a 3];
44 }
45
46
47 // --- Minified Issue --- //
48
49 macro_rules! m {
50     ( $()* ) => {}
51     //~^ ERROR repetition matches empty token tree
52 }
53
54 m!();