From 482a67d20f3c7059c33368df424f781585ead7cc Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 3 Jan 2021 10:09:32 -0500 Subject: Properly handle `SyntaxContext` of dummy spans in incr comp Fixes #80336 Due to macro expansion, we may end up with spans with an invalid location and non-root `SyntaxContext`. This commits preserves the `SyntaxContext` of such spans in the incremental cache, and ensures that we always hash the `SyntaxContext` when computing the `Fingerprint` of a `Span` Previously, we would discard the `SyntaxContext` during serialization to the incremental cache, causing the span's `Fingerprint` to change across compilation sessions. --- src/test/incremental/issue-80336-invalid-span.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/test/incremental/issue-80336-invalid-span.rs (limited to 'src') diff --git a/src/test/incremental/issue-80336-invalid-span.rs b/src/test/incremental/issue-80336-invalid-span.rs new file mode 100644 index 00000000000..7757d915911 --- /dev/null +++ b/src/test/incremental/issue-80336-invalid-span.rs @@ -0,0 +1,10 @@ +// Regression test for issue #80336 +// Test that we properly handle encoding, decoding, and hashing +// of spans with an invalid location and non-root `SyntaxContext` + +// revisions:rpass1 rpass2 +// only-x86_64 + +pub fn main() { + let _ = is_x86_feature_detected!("avx2"); +} -- cgit 1.4.1-3-g733a5