about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-13 23:24:31 +0000
committerbors <bors@rust-lang.org>2021-01-13 23:24:31 +0000
commit180fdffa17e5598d31eb1eaa2697bd57ef1b8a29 (patch)
tree5387ea7dd3ef91e4cd98fa204fb4b44fe6e2f9e4 /src/test
parenta62a76047ea24aad7639f14eb3ce0e620b77bdb7 (diff)
parent482a67d20f3c7059c33368df424f781585ead7cc (diff)
downloadrust-180fdffa17e5598d31eb1eaa2697bd57ef1b8a29.tar.gz
rust-180fdffa17e5598d31eb1eaa2697bd57ef1b8a29.zip
Auto merge of #80654 - Aaron1011:fix/dummy-span-ctxt, r=wesleywiser
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/issue-80336-invalid-span.rs10
1 files changed, 10 insertions, 0 deletions
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");
+}