]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/decl_macro.rs
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
[rust.git] / tests / rustdoc / decl_macro.rs
1 // compile-flags: --document-private-items
2
3 #![feature(decl_macro)]
4
5 // @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
6 // @has - //pre '...'
7 // @has - //pre '}'
8 pub macro my_macro() {
9
10 }
11
12 // @has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
13 // @has - //pre '...'
14 // @has - //pre '}'
15 pub macro my_macro_2($($tok:tt)*) {
16
17 }
18
19 // @has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {'
20 // @has - //pre '(_) => { ... },'
21 // @has - //pre '($foo:ident . $bar:expr) => { ... },'
22 // @has - //pre '($($foo:literal),+) => { ... },'
23 // @has - //pre '}'
24 pub macro my_macro_multi {
25     (_) => {
26
27     },
28     ($foo:ident . $bar:expr) => {
29
30     },
31     ($($foo:literal),+) => {
32
33     }
34 }
35
36 // @has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {'
37 // @has - //pre '...'
38 // @has - //pre '}'
39 pub macro by_example_single {
40     ($foo:expr) => {}
41 }
42
43 mod a {
44     mod b {
45         // @has decl_macro/a/b/macro.by_example_vis.html //pre 'pub(super) macro by_example_vis($foo:expr) {'
46         pub(in super) macro by_example_vis {
47             ($foo:expr) => {}
48         }
49         mod c {
50             // @has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {'
51             pub(in a) macro by_example_vis_named {
52                 ($foo:expr) => {}
53             }
54         }
55     }
56 }