Commit Graph

6 Commits

Author SHA1 Message Date
Aaron Hill db6b3c1ce4
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 14:41:51 -04:00
Aaron Hill f7235a898a
Normalize the test output of hygiene-related tests
A raw SyntaxContext id is implicitly dependent on the target platform,
since libstd and libcore have platform-dependent #[cfg]s which affect
which macros are invoked. As a result, we must strip out any
SyntaxContext ids from test output to ensure that the captured stdout is
not platform-dependent.
2020-07-26 20:05:02 -04:00
Vadim Petrochenkov 5ae38bbc7c Stabilize proc macros in type positions 2019-09-30 21:59:35 +03:00
Vadim Petrochenkov 4cb67c0f1c Add a test case with `$crate` from other crate 2019-07-09 22:45:25 +03:00
Vadim Petrochenkov 3997507786 Resolve `$crate` in all hygienic contexts for pretty-pringing
Stop visiting AST to discover those contexts, just iterate through hygiene data instead
2019-07-09 22:17:44 +03:00
Vadim Petrochenkov 7aaf0de700 Add a test for `$crate` inside macro invocation 2019-07-09 22:17:44 +03:00