]> git.lizzy.rs Git - rust.git/blob - src/test/ui/macros/trace_faulty_macros.rs
Rollup merge of #70349 - Centril:hir-outa-rustc, r=Zoxc
[rust.git] / src / test / ui / macros / trace_faulty_macros.rs
1 // compile-flags: -Z trace-macros
2
3 #![recursion_limit = "4"]
4
5 macro_rules! my_faulty_macro {
6     () => {
7         my_faulty_macro!(bcd); //~ ERROR no rules
8     };
9 }
10
11 macro_rules! pat_macro {
12     () => {
13         pat_macro!(A{a:a, b:0, c:_, ..});
14     };
15     ($a:pat) => {
16         $a //~ ERROR expected expression
17     };
18 }
19
20 macro_rules! my_recursive_macro {
21     () => {
22         my_recursive_macro!(); //~ ERROR recursion limit
23     };
24 }
25
26 macro_rules! my_macro {
27     () => {};
28 }
29
30 fn main() {
31     my_faulty_macro!();
32     my_recursive_macro!();
33     test!();
34     non_exisiting!();
35     derive!(Debug);
36     let a = pat_macro!();
37 }
38
39 #[my_macro]
40 fn use_bang_macro_as_attr() {}
41
42 #[derive(Debug)] //~ ERROR `derive` may only be applied to structs
43 fn use_derive_macro_as_attr() {}