fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1PRINT-BANG INPUT (DISPLAY): struct S; 2PRINT-BANG RE-COLLECTED (DISPLAY): struct S ; 3PRINT-BANG INPUT (DEBUG): TokenStream [ 4 Group { 5 delimiter: None, 6 stream: TokenStream [ 7 Ident { 8 ident: "struct", 9 span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4), 10 }, 11 Ident { 12 ident: "S", 13 span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4), 14 }, 15 Punct { 16 ch: ';', 17 spacing: Alone, 18 span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4), 19 }, 20 ], 21 span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5), 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// ignore-tidy-linelength 32// normalize-stdout-test "\d+#" -> "0#" 33// normalize-stdout-test "expn\d{3,}" -> "expnNNN" 34// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */" 35// aux-build:test-macros.rs 36 37#![feature /* 0#0 */(decl_macro)] 38#![no_std /* 0#0 */] 39#[prelude_import /* 0#1 */] 40use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; 41#[macro_use /* 0#1 */] 42extern crate core /* 0#2 */; 43extern crate compiler_builtins /* NNN */ as _ /* 0#2 */; 44// Don't load unnecessary hygiene information from std 45extern crate std /* 0#0 */; 46 47#[macro_use /* 0#0 */] 48extern crate test_macros /* 0#0 */; 49 50macro_rules! outer 51 /* 52 0#0 53 */ { 54 ($item : item) => 55 { 56 macro inner() { print_bang! { $item } } inner! () ; 57 58 } ; 59} 60 61struct S /* 0#0 */; 62macro inner /* 0#3 */ { () => { print_bang! { struct S; } } } 63 64struct S /* 0#4 */; 65// OK, not a duplicate definition of `S` 66 67fn main /* 0#0 */() {} 68 69/* 70Expansions: 71crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root 72crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) 73crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer") 74crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner") 75crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang") 76crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") 77crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") 78crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include") 79 80SyntaxContexts: 81#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque) 82#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque) 83#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent) 84#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent) 85#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque) 86#5: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque) 87#6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque) 88#7: parent: #5, outer_mark: (crate0::{{expn4}}, Transparent) 89#8: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent) 90*/