File: decl_macro.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (58 lines) | stat: -rw-r--r-- 1,595 bytes parent folder | download | duplicates (3)
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
57
58
//@ 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) {'
            // Regression test for <https://github.com/rust-lang/rust/issues/83000>:
            //@ has - '//pre[@class="rust item-decl"]//a[@class="mod"]/@href' '../../index.html'
            pub(in a) macro by_example_vis_named {
                ($foo:expr) => {}
            }
        }
    }
}