Remove normalization of Span
debug output in proc-macro tests
#75345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #74800
The definition of
is_x86_feature_detected!
(and similar macros)depends on the platform - it is produced by a
cfg_if!
invocation onx86, and a plain
#[cfg]
on other platforms. Since it is part of theprelude, 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, sincethe captured output will be platform-dependent.
Previously, we replaced all
SyntaxContext
ids with "#CTXT", and theraw
Span
lo/hi bytes with "LO..HI".This commit adds
#![no_std]
andextern crate std
to all proc-macrotests 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 stableacross all platforms.
Additionally, we use
-Z span-debug
in more places, which lets us avoidthe "LO..HI" normalization hack.