1- Def site: $DIR/auxiliary/make-macro.rs:7:9: 10:10 (#6)
1+ Def site: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7)
2+ Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:20:37: 20:43 (#6) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:20:43: 20:45 (#6) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:20:43: 20:45 (#6) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:20:45: 20:50 (#6) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:20:50: 20:51 (#6) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:20:51: 20:53 (#6) }]
3+ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7) }]
24#![feature /* 0#0 */(prelude_import)]
35#[prelude_import /* 0#1 */]
46use std /* 0#1 */::prelude /* 0#1 */::v1 /* 0#1 */::*;
@@ -7,24 +9,43 @@ extern crate std /* 0#1 */;
79// aux-build:make-macro.rs
810// aux-build:meta-macro.rs
911// edition:2018
10- // compile-flags: -Z span-debug -Z unpretty=expanded,hygiene
12+ // compile-flags: -Z span-debug -Z unpretty=expanded,hygiene -Z macro-backtrace
1113// check-pass
1214// normalize-stdout-test "\d+#" -> "0#"
13- // ^ We don't care about symbol ids, so set them all to 0
15+ //
16+ // We don't care about symbol ids, so we set them all to 0
1417// in the stdout
1518extern crate meta_macro /* 0#0 */;
19+ extern crate make_macro /* 0#0 */;
20+
21+ macro_rules! produce_it
22+ /*
23+ 0#0
24+ */ {
25+ () =>
26+ {
27+ meta_macro :: print_def_site ! ($ crate :: dummy ! ()) ;
28+ // `print_def_site!` will respan the `$crate` identifier
29+ // with `Span::def_site()`. This should cause it to resolve
30+ // relative to `meta_macro`, *not* `make_macro` (despite
31+ // the fact that that `print_def_site` is produced by
32+ // a `macro_rules!` macro in `make_macro`).
33+ }
34+ }
1635
1736fn main /* 0#0 */() { }
1837
1938/*
2039Expansions:
21400: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
22411: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
23- 2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site ")
42+ 2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it ")
24433: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "cfg_if")
25444: parent: ExpnId(3), call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::cfg_if")
26455: parent: ExpnId(4), call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "$crate::cfg_if")
27466: parent: ExpnId(5), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "features")
47+ 7: parent: ExpnId(2), call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
48+ 8: parent: ExpnId(7), call_site_ctxt: #7, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
2849
2950SyntaxContexts:
3051#0: parent: #0, outer_mark: (ExpnId(0), Opaque)
@@ -33,7 +54,11 @@ SyntaxContexts:
3354#3: parent: #0, outer_mark: (ExpnId(6), SemiTransparent)
3455#4: parent: #0, outer_mark: (ExpnId(3), SemiTransparent)
3556#5: parent: #0, outer_mark: (ExpnId(4), SemiTransparent)
36- #6: parent: #0, outer_mark: (ExpnId(2), Opaque)
37- #7: parent: #0, outer_mark: (ExpnId(2), Transparent)
38- #8: parent: #0, outer_mark: (ExpnId(2), SemiTransparent)
57+ #6: parent: #0, outer_mark: (ExpnId(2), SemiTransparent)
58+ #7: parent: #0, outer_mark: (ExpnId(7), Opaque)
59+ #8: parent: #6, outer_mark: (ExpnId(7), Transparent)
60+ #9: parent: #0, outer_mark: (ExpnId(7), SemiTransparent)
61+ #10: parent: #0, outer_mark: (ExpnId(8), Opaque)
62+ #11: parent: #7, outer_mark: (ExpnId(8), Transparent)
63+ #12: parent: #7, outer_mark: (ExpnId(8), SemiTransparent)
3964*/
0 commit comments