]>
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", | |
9 | span: $DIR/nonterminal-token-hygiene.rs:30:5: 30:11 (#5), | |
10 | }, | |
11 | Ident { | |
12 | ident: "S", | |
13 | span: $DIR/nonterminal-token-hygiene.rs:30:12: 30:13 (#5), | |
14 | }, | |
15 | Punct { | |
16 | ch: ';', | |
17 | spacing: Alone, | |
18 | span: $DIR/nonterminal-token-hygiene.rs:30:13: 30:14 (#5), | |
19 | }, | |
20 | ], | |
21 | span: $DIR/nonterminal-token-hygiene.rs:20:27: 20:32 (#6), | |
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#" | |
32 | // aux-build:test-macros.rs | |
33 | ||
34 | #![feature /* 0#0 */(decl_macro)] | |
35 | ||
36 | #![no_std /* 0#0 */] | |
37 | #[prelude_import /* 0#1 */] | |
6a06907d | 38 | use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; |
29967ef6 XL |
39 | #[macro_use /* 0#1 */] |
40 | extern crate core /* 0#2 */; | |
41 | #[macro_use /* 0#1 */] | |
42 | extern crate compiler_builtins /* 0#2 */; | |
43 | // Don't load unnecessary hygiene information from std | |
44 | extern crate std /* 0#0 */; | |
45 | ||
46 | #[macro_use /* 0#0 */] | |
47 | extern crate test_macros /* 0#0 */; | |
48 | ||
49 | macro_rules! outer | |
50 | /* | |
51 | 0#0 | |
52 | */ { | |
53 | ($ item : item) => | |
54 | { | |
55 | macro inner() { print_bang ! { $ item } } inner ! () ; | |
56 | ||
57 | } ; | |
58 | } | |
59 | ||
60 | struct S /* 0#0 */; | |
61 | macro inner /* 0#4 */ { () => { print_bang ! { struct S; } } } | |
62 | ||
63 | struct S /* 0#5 */; | |
64 | // OK, not a duplicate definition of `S` | |
65 | ||
66 | fn main /* 0#0 */() { } | |
67 | ||
68 | /* | |
69 | Expansions: | |
70 | 0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root | |
71 | 1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) | |
72 | 2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer") | |
73 | 3: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) | |
74 | 4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #4, kind: Macro(Bang, "inner") | |
75 | 5: parent: ExpnId(4), call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "print_bang") | |
76 | ||
77 | SyntaxContexts: | |
78 | #0: parent: #0, outer_mark: (ExpnId(0), Opaque) | |
79 | #1: parent: #0, outer_mark: (ExpnId(1), Opaque) | |
80 | #2: parent: #0, outer_mark: (ExpnId(1), Transparent) | |
81 | #3: parent: #0, outer_mark: (ExpnId(3), Opaque) | |
82 | #4: parent: #0, outer_mark: (ExpnId(2), SemiTransparent) | |
83 | #5: parent: #0, outer_mark: (ExpnId(4), Opaque) | |
84 | #6: parent: #4, outer_mark: (ExpnId(4), Opaque) | |
85 | #7: parent: #0, outer_mark: (ExpnId(5), Opaque) | |
86 | #8: parent: #6, outer_mark: (ExpnId(5), Transparent) | |
87 | #9: parent: #5, outer_mark: (ExpnId(5), SemiTransparent) | |
88 | */ |