summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc/decl_macro.rs
blob: 94ade31b5e5f4ce4f12bc5c5a830dc0d7cd400da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// compile-flags: --document-private-items

#![feature(decl_macro)]

// @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
// @has - //pre '...'
// @has - //pre '}'
pub macro my_macro() {

}

// @has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
// @has - //pre '...'
// @has - //pre '}'
pub macro my_macro_2($($tok:tt)*) {

}

// @has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {'
// @has - //pre '(_) => { ... },'
// @has - //pre '($foo:ident . $bar:expr) => { ... },'
// @has - //pre '($($foo:literal),+) => { ... },'
// @has - //pre '}'
pub macro my_macro_multi {
    (_) => {

    },
    ($foo:ident . $bar:expr) => {

    },
    ($($foo:literal),+) => {

    }
}

// @has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {'
// @has - //pre '...'
// @has - //pre '}'
pub macro by_example_single {
    ($foo:expr) => {}
}

mod a {
    mod b {
        // @has decl_macro/a/b/macro.by_example_vis.html //pre 'pub(super) macro by_example_vis($foo:expr) {'
        pub(in super) macro by_example_vis {
            ($foo:expr) => {}
        }
        mod c {
            // @has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {'
            pub(in a) macro by_example_vis_named {
                ($foo:expr) => {}
            }
        }
    }
}