about summary refs log tree commit diff
path: root/src/test/ui/proc-macro/nested-macro-rules.rs
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-08-09 13:36:31 -0400
committerAaron Hill <aa1ronham@gmail.com>2020-08-09 14:41:51 -0400
commitdb6b3c1ce4004b7834cbeb6d6b5feac74f7cd4c0 (patch)
treea48decd23c235b4d337a4f9ad123da21a024415c /src/test/ui/proc-macro/nested-macro-rules.rs
parent543f03d24118d3af784aa98c507c00e30c796a0e (diff)
downloadrust-db6b3c1ce4004b7834cbeb6d6b5feac74f7cd4c0.tar.gz
rust-db6b3c1ce4004b7834cbeb6d6b5feac74f7cd4c0.zip
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.
Diffstat (limited to 'src/test/ui/proc-macro/nested-macro-rules.rs')
-rw-r--r--src/test/ui/proc-macro/nested-macro-rules.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/ui/proc-macro/nested-macro-rules.rs b/src/test/ui/proc-macro/nested-macro-rules.rs
index 62c3dd84ce1..2fef0e5fad0 100644
--- a/src/test/ui/proc-macro/nested-macro-rules.rs
+++ b/src/test/ui/proc-macro/nested-macro-rules.rs
@@ -2,9 +2,11 @@
 // aux-build:nested-macro-rules.rs
 // aux-build:test-macros.rs
 // compile-flags: -Z span-debug
-// normalize-stdout-test "#\d+" -> "#CTXT"
 // edition:2018
 
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
 extern crate nested_macro_rules;
 extern crate test_macros;