2020-09-12 22:26:17 -05:00
|
|
|
Def site: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5)
|
|
|
|
Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:24:37: 24:43 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:24:43: 24:45 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:43: 24:45 (#4) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:24:45: 24:50 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:50: 24:51 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:24:51: 24:53 (#4) }]
|
|
|
|
Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 16:10 (#5) }]
|
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 12:36:31 -05:00
|
|
|
#![feature /* 0#0 */(prelude_import)]
|
2020-09-02 02:40:56 -05:00
|
|
|
// ignore-tidy-linelength
|
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 12:36:31 -05:00
|
|
|
// aux-build:make-macro.rs
|
|
|
|
// aux-build:meta-macro.rs
|
|
|
|
// edition:2018
|
2020-09-02 02:40:56 -05:00
|
|
|
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
|
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 12:36:31 -05:00
|
|
|
// check-pass
|
|
|
|
// normalize-stdout-test "\d+#" -> "0#"
|
|
|
|
//
|
|
|
|
// We don't care about symbol ids, so we set them all to 0
|
|
|
|
// in the stdout
|
|
|
|
|
|
|
|
#![no_std /* 0#0 */]
|
|
|
|
#[prelude_import /* 0#1 */]
|
|
|
|
use core /* 0#1 */::prelude /* 0#1 */::v1 /* 0#1 */::*;
|
|
|
|
#[macro_use /* 0#1 */]
|
|
|
|
extern crate core /* 0#1 */;
|
|
|
|
#[macro_use /* 0#1 */]
|
|
|
|
extern crate compiler_builtins /* 0#1 */;
|
|
|
|
// Don't load unnecessary hygiene information from std
|
|
|
|
extern crate std /* 0#0 */;
|
|
|
|
|
|
|
|
extern crate meta_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")
|
2020-09-12 22:26:17 -05:00
|
|
|
3: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
|
|
|
|
4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
|
|
|
|
5: parent: ExpnId(4), call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
|
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 12:36:31 -05:00
|
|
|
|
|
|
|
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)
|
2020-09-12 22:26:17 -05:00
|
|
|
#3: parent: #0, outer_mark: (ExpnId(3), Opaque)
|
|
|
|
#4: parent: #0, outer_mark: (ExpnId(2), SemiTransparent)
|
|
|
|
#5: parent: #0, outer_mark: (ExpnId(4), Opaque)
|
|
|
|
#6: parent: #4, outer_mark: (ExpnId(4), Transparent)
|
|
|
|
#7: parent: #0, outer_mark: (ExpnId(4), SemiTransparent)
|
|
|
|
#8: parent: #0, outer_mark: (ExpnId(5), Opaque)
|
|
|
|
#9: parent: #5, outer_mark: (ExpnId(5), Transparent)
|
|
|
|
#10: parent: #5, outer_mark: (ExpnId(5), SemiTransparent)
|
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
2020-08-09 12:36:31 -05:00
|
|
|
*/
|