summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
blob: 5c70e780f74893d97aaed368b89b2d807ff75714 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
PRINT-BANG INPUT (DISPLAY): struct S;
PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): struct S ;
PRINT-BANG INPUT (DEBUG): TokenStream [
    Group {
        delimiter: None,
        stream: TokenStream [
            Ident {
                ident: "struct",
                span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4),
            },
            Ident {
                ident: "S",
                span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4),
            },
            Punct {
                ch: ';',
                spacing: Alone,
                span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4),
            },
        ],
        span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5),
    },
]
#![feature /* 0#0 */(prelude_import)]
#![no_std /* 0#0 */]
// Make sure that marks from declarative macros are applied to tokens in nonterminal.

// check-pass
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
// compile-flags: -Z trim-diagnostic-paths=no
// ignore-tidy-linelength
// normalize-stdout-test "\d+#" -> "0#"
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
// aux-build:test-macros.rs

#![feature /* 0#0 */(decl_macro)]
#![no_std /* 0#0 */]
#[prelude_import /* 0#1 */]
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
#[macro_use /* 0#1 */]
extern crate core /* 0#2 */;
extern crate compiler_builtins /* NNN */ as _ /* 0#2 */;
// Don't load unnecessary hygiene information from std
extern crate std /* 0#0 */;

#[macro_use /* 0#0 */]
extern crate test_macros /* 0#0 */;

macro_rules! outer
    /*
    0#0
    */ {
    ($item:item) =>
    {
        macro inner() { print_bang! { $item } } inner!();

    };
}

struct S /* 0#0 */;
macro inner /* 0#3 */ { () => { print_bang! { struct S; } } }

struct S /* 0#4 */;
// OK, not a duplicate definition of `S`

fn main /* 0#0 */() {}

/*
Expansions:
crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer")
crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner")
crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")

SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
#5: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque)
#6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
#7: parent: #5, outer_mark: (crate0::{{expn4}}, Transparent)
#8: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent)
*/