rust/src/test/ui/proc-macro/meta-macro-hygiene.stdout
Aaron Hill 979dd77c5d
Add test for serializing hygiene *into* a proc-macro crate
This is a very obscure corner case, and should never be hit in practice.
2020-07-26 18:37:02 -04:00

65 lines
3.6 KiB
Plaintext

Def site: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#7)
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) }]
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) }]
#![feature /* 0#0 */(prelude_import)]
#[prelude_import /* 0#1 */]
use std /* 0#1 */::prelude /* 0#1 */::v1 /* 0#1 */::*;
#[macro_use /* 0#1 */]
extern crate std /* 0#1 */;
// aux-build:make-macro.rs
// aux-build:meta-macro.rs
// edition:2018
// compile-flags: -Z span-debug -Z unpretty=expanded,hygiene -Z macro-backtrace
// check-pass
// normalize-stdout-test "\d+#" -> "0#"
//
// We don't care about symbol ids, so we set them all to 0
// in the stdout
extern crate meta_macro /* 0#0 */;
extern crate make_macro /* 0#0 */;
macro_rules! produce_it
/*
0#0
*/ {
() =>
{
meta_macro :: print_def_site ! ($ crate :: dummy ! ()) ;
// `print_def_site!` will respan the `$crate` identifier
// with `Span::def_site()`. This should cause it to resolve
// relative to `meta_macro`, *not* `make_macro` (despite
// the fact that that `print_def_site` is produced by
// a `macro_rules!` macro in `make_macro`).
}
}
fn main /* 0#0 */() { }
/*
Expansions:
0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it")
3: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "cfg_if")
4: parent: ExpnId(3), call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::cfg_if")
5: parent: ExpnId(4), call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "$crate::cfg_if")
6: parent: ExpnId(5), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "features")
7: parent: ExpnId(2), call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
8: parent: ExpnId(7), call_site_ctxt: #7, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
SyntaxContexts:
#0: parent: #0, outer_mark: (ExpnId(0), Opaque)
#1: parent: #0, outer_mark: (ExpnId(1), Opaque)
#2: parent: #0, outer_mark: (ExpnId(1), Transparent)
#3: parent: #0, outer_mark: (ExpnId(6), SemiTransparent)
#4: parent: #0, outer_mark: (ExpnId(3), SemiTransparent)
#5: parent: #0, outer_mark: (ExpnId(4), SemiTransparent)
#6: parent: #0, outer_mark: (ExpnId(2), SemiTransparent)
#7: parent: #0, outer_mark: (ExpnId(7), Opaque)
#8: parent: #6, outer_mark: (ExpnId(7), Transparent)
#9: parent: #0, outer_mark: (ExpnId(7), SemiTransparent)
#10: parent: #0, outer_mark: (ExpnId(8), Opaque)
#11: parent: #7, outer_mark: (ExpnId(8), Transparent)
#12: parent: #7, outer_mark: (ExpnId(8), SemiTransparent)
*/