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. --- compiler/rustc_span/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index f0f9f940446..50cb1555486 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -1899,8 +1899,9 @@ where return; } - if *self == DUMMY_SP { + if self.is_dummy() { Hash::hash(&TAG_INVALID_SPAN, hasher); + self.ctxt().hash_stable(ctx, hasher); return; } -- cgit 1.4.1-3-g733a5