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.
54 lines
1.4 KiB
Text
54 lines
1.4 KiB
Text
PRINT-BANG INPUT (DISPLAY): /**
|
|
*******
|
|
* DOC *
|
|
* DOC *
|
|
* DOC *
|
|
*******
|
|
*/
|
|
pub struct S ;
|
|
PRINT-BANG RE-COLLECTED (DISPLAY): #[doc = "\n*******\n* DOC *\n* DOC *\n* DOC *\n*******\n"] pub struct S ;
|
|
PRINT-BANG INPUT (DEBUG): TokenStream [
|
|
Punct {
|
|
ch: '#',
|
|
spacing: Alone,
|
|
span: $DIR/doc-comment-preserved.rs:13:1: 19:3 (#0),
|
|
},
|
|
Group {
|
|
delimiter: Bracket,
|
|
stream: TokenStream [
|
|
Ident {
|
|
ident: "doc",
|
|
span: $DIR/doc-comment-preserved.rs:13:1: 19:3 (#0),
|
|
},
|
|
Punct {
|
|
ch: '=',
|
|
spacing: Alone,
|
|
span: $DIR/doc-comment-preserved.rs:13:1: 19:3 (#0),
|
|
},
|
|
Literal {
|
|
kind: Str,
|
|
symbol: "\n*******\n* DOC *\n* DOC *\n* DOC *\n*******\n",
|
|
suffix: None,
|
|
span: $DIR/doc-comment-preserved.rs:13:1: 19:3 (#0),
|
|
},
|
|
],
|
|
span: $DIR/doc-comment-preserved.rs:13:1: 19:3 (#0),
|
|
},
|
|
Ident {
|
|
ident: "pub",
|
|
span: $DIR/doc-comment-preserved.rs:20:1: 20:4 (#0),
|
|
},
|
|
Ident {
|
|
ident: "struct",
|
|
span: $DIR/doc-comment-preserved.rs:20:5: 20:11 (#0),
|
|
},
|
|
Ident {
|
|
ident: "S",
|
|
span: $DIR/doc-comment-preserved.rs:20:12: 20:13 (#0),
|
|
},
|
|
Punct {
|
|
ch: ';',
|
|
spacing: Alone,
|
|
span: $DIR/doc-comment-preserved.rs:20:13: 20:14 (#0),
|
|
},
|
|
]
|