2020-05-31 00:20:06 +03:00
|
|
|
PRINT-BANG INPUT (DISPLAY): A
|
|
|
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
|
|
|
Group {
|
|
|
|
delimiter: None,
|
|
|
|
stream: TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "A",
|
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 13:36:31 -04:00
|
|
|
span: #0 bytes(503..504),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
],
|
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 13:36:31 -04:00
|
|
|
span: #3 bytes(370..372),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
]
|
2020-06-14 14:30:42 +03:00
|
|
|
PRINT-ATTR INPUT (DISPLAY): const A : u8 = 0 ;
|
2020-05-31 00:20:06 +03:00
|
|
|
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "const",
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(416..421),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
2020-06-24 01:52:48 -04:00
|
|
|
Group {
|
|
|
|
delimiter: None,
|
|
|
|
stream: TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "A",
|
|
|
|
span: #0 bytes(503..504),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
span: #3 bytes(422..424),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Punct {
|
|
|
|
ch: ':',
|
|
|
|
spacing: Alone,
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(424..425),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Ident {
|
|
|
|
ident: "u8",
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(426..428),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Punct {
|
|
|
|
ch: '=',
|
|
|
|
spacing: Alone,
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(429..430),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Literal {
|
|
|
|
kind: Integer,
|
|
|
|
symbol: "0",
|
|
|
|
suffix: None,
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(431..432),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Punct {
|
|
|
|
ch: ';',
|
|
|
|
spacing: Alone,
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(432..433),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
]
|
2020-06-14 14:30:42 +03:00
|
|
|
PRINT-DERIVE INPUT (DISPLAY): struct A { }
|
2020-05-31 00:20:06 +03:00
|
|
|
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "struct",
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(468..474),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
2020-06-24 01:52:48 -04:00
|
|
|
Group {
|
|
|
|
delimiter: None,
|
|
|
|
stream: TokenStream [
|
|
|
|
Ident {
|
|
|
|
ident: "A",
|
|
|
|
span: #0 bytes(503..504),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
span: #3 bytes(475..477),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
Group {
|
|
|
|
delimiter: Brace,
|
|
|
|
stream: TokenStream [],
|
2020-06-24 01:52:48 -04:00
|
|
|
span: #3 bytes(478..480),
|
2020-05-31 00:20:06 +03:00
|
|
|
},
|
|
|
|
]
|