]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | PRINT-BANG INPUT (DISPLAY): struct S; |
2 | PRINT-BANG RE-COLLECTED (DISPLAY): struct S ; | |
3 | PRINT-BANG INPUT (DEBUG): TokenStream [ | |
4 | Group { | |
5 | delimiter: None, | |
6 | stream: TokenStream [ | |
7 | Ident { | |
8 | ident: "struct", | |
c295e0f8 | 9 | span: $DIR/nonterminal-token-hygiene.rs:31:5: 31:11 (#5), |
29967ef6 XL |
10 | }, |
11 | Ident { | |
12 | ident: "S", | |
c295e0f8 | 13 | span: $DIR/nonterminal-token-hygiene.rs:31:12: 31:13 (#5), |
29967ef6 XL |
14 | }, |
15 | Punct { | |
16 | ch: ';', | |
17 | spacing: Alone, | |
c295e0f8 | 18 | span: $DIR/nonterminal-token-hygiene.rs:31:13: 31:14 (#5), |
29967ef6 XL |
19 | }, |
20 | ], | |
c295e0f8 | 21 | span: $DIR/nonterminal-token-hygiene.rs:21:27: 21:32 (#6), |
29967ef6 XL |
22 | }, |
23 | ] | |
24 | #![feature /* 0#0 */(prelude_import)] | |
25 | #![no_std /* 0#0 */] | |
26 | // Make sure that marks from declarative macros are applied to tokens in nonterminal. | |
27 | ||
28 | // check-pass | |
29 | // compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene | |
30 | // compile-flags: -Z trim-diagnostic-paths=no | |
31 | // normalize-stdout-test "\d+#" -> "0#" | |
c295e0f8 | 32 | // normalize-stdout-test "expn\d{3,}" -> "expnNNN" |
29967ef6 XL |
33 | // aux-build:test-macros.rs |
34 | ||
35 | #![feature /* 0#0 */(decl_macro)] | |
36 | ||
37 | #![no_std /* 0#0 */] | |
38 | #[prelude_import /* 0#1 */] | |
6a06907d | 39 | use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; |
29967ef6 XL |
40 | #[macro_use /* 0#1 */] |
41 | extern crate core /* 0#2 */; | |
42 | #[macro_use /* 0#1 */] | |
43 | extern crate compiler_builtins /* 0#2 */; | |
44 | // Don't load unnecessary hygiene information from std | |
45 | extern crate std /* 0#0 */; | |
46 | ||
47 | #[macro_use /* 0#0 */] | |
48 | extern crate test_macros /* 0#0 */; | |
49 | ||
50 | macro_rules! outer | |
51 | /* | |
52 | 0#0 | |
53 | */ { | |
136023e0 | 54 | ($item : item) => |
29967ef6 | 55 | { |
136023e0 | 56 | macro inner() { print_bang! { $item } } inner! () ; |
29967ef6 XL |
57 | |
58 | } ; | |
59 | } | |
60 | ||
61 | struct S /* 0#0 */; | |
17df50a5 | 62 | macro inner /* 0#4 */ { () => { print_bang! { struct S; } } } |
29967ef6 XL |
63 | |
64 | struct S /* 0#5 */; | |
65 | // OK, not a duplicate definition of `S` | |
66 | ||
a2a8927a | 67 | fn main /* 0#0 */() {} |
29967ef6 XL |
68 | |
69 | /* | |
70 | Expansions: | |
136023e0 XL |
71 | crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root |
72 | crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) | |
73 | crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer") | |
74 | crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #4, def_site_ctxt: #4, kind: Macro(Bang, "inner") | |
75 | crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "print_bang") | |
3c0e092e XL |
76 | crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") |
77 | crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") | |
c295e0f8 | 78 | crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include") |
136023e0 | 79 | crate2::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) |
29967ef6 XL |
80 | |
81 | SyntaxContexts: | |
136023e0 XL |
82 | #0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque) |
83 | #1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque) | |
84 | #2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent) | |
85 | #3: parent: #0, outer_mark: (crate2::{{expn1}}, Opaque) | |
86 | #4: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent) | |
87 | #5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque) | |
88 | #6: parent: #4, outer_mark: (crate0::{{expn3}}, Opaque) | |
89 | #7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque) | |
90 | #8: parent: #6, outer_mark: (crate0::{{expn4}}, Transparent) | |
91 | #9: parent: #5, outer_mark: (crate0::{{expn4}}, SemiTransparent) | |
29967ef6 | 92 | */ |