2020-11-05 21:36:30 +00:00
|
|
|
PRINT-BANG INPUT (DISPLAY): struct S;
|
|
|
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
|
|
|
Group {
|
|
|
|
delimiter: None,
|
|
|
|
stream: TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "struct",
|
2023-07-29 21:44:17 +00:00
|
|
|
span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4),
|
2020-11-05 21:36:30 +00:00
|
|
|
},
|
|
|
|
Ident {
|
|
|
|
ident: "S",
|
2023-07-29 21:44:17 +00:00
|
|
|
span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4),
|
2020-11-05 21:36:30 +00:00
|
|
|
},
|
|
|
|
Punct {
|
|
|
|
ch: ';',
|
|
|
|
spacing: Alone,
|
2023-07-29 21:44:17 +00:00
|
|
|
span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4),
|
2020-11-05 21:36:30 +00:00
|
|
|
},
|
|
|
|
],
|
2023-07-29 21:44:17 +00:00
|
|
|
span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5),
|
2020-11-05 21:36:30 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
#![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
|
2023-07-29 21:44:17 +00:00
|
|
|
// ignore-tidy-linelength
|
2020-11-05 21:36:30 +00:00
|
|
|
//@ normalize-stdout-test "\d+#" -> "0#"
|
2021-09-24 23:27:00 +00:00
|
|
|
//@ normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
2023-07-29 21:44:17 +00:00
|
|
|
//@ normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
2020-11-05 21:36:30 +00:00
|
|
|
//@ aux-build:test-macros.rs
|
|
|
|
|
|
|
|
#![feature /* 0#0 */(decl_macro)]
|
|
|
|
#![no_std /* 0#0 */]
|
|
|
|
#[prelude_import /* 0#1 */]
|
2021-02-17 14:52:31 +00:00
|
|
|
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
|
2020-11-05 21:36:30 +00:00
|
|
|
#[macro_use /* 0#1 */]
|
|
|
|
extern crate core /* 0#2 */;
|
2023-07-29 21:44:17 +00:00
|
|
|
extern crate compiler_builtins /* NNN */ as _ /* 0#2 */;
|
2020-11-05 21:36:30 +00:00
|
|
|
// 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
|
|
|
|
*/ {
|
2023-08-08 01:43:44 +00:00
|
|
|
($item:item) =>
|
2020-11-05 21:36:30 +00:00
|
|
|
{
|
2023-10-12 04:36:14 +00:00
|
|
|
macro inner() { print_bang! { $item } } inner!();
|
2020-11-05 21:36:30 +00:00
|
|
|
|
2023-10-12 04:36:14 +00:00
|
|
|
};
|
2020-11-05 21:36:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct S /* 0#0 */;
|
2023-07-10 22:16:28 +00:00
|
|
|
macro inner /* 0#3 */ { () => { print_bang! { struct S; } } }
|
2020-11-05 21:36:30 +00:00
|
|
|
|
2023-07-10 22:16:28 +00:00
|
|
|
struct S /* 0#4 */;
|
2020-11-05 21:36:30 +00:00
|
|
|
// OK, not a duplicate definition of `S`
|
|
|
|
|
2021-12-01 19:45:14 +00:00
|
|
|
fn main /* 0#0 */() {}
|
2020-11-05 21:36:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Expansions:
|
2021-06-25 18:43:04 +00:00
|
|
|
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")
|
2023-07-10 22:16:28 +00:00
|
|
|
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")
|
2023-12-22 13:30:12 +00:00
|
|
|
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
|
|
|
|
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
|
|
|
|
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
|
2021-10-21 21:06:40 +00:00
|
|
|
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")
|
2021-09-24 23:27:00 +00:00
|
|
|
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")
|
2020-11-05 21:36:30 +00:00
|
|
|
|
|
|
|
SyntaxContexts:
|
2021-06-25 18:43:04 +00:00
|
|
|
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
|
|
|
|
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
|
|
|
|
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
|
2023-07-10 22:16:28 +00:00
|
|
|
#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)
|
2020-11-05 21:36:30 +00:00
|
|
|
*/
|