1
Fork 0

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.
This commit is contained in:
bors 2021-01-13 23:24:31 +00:00
commit 180fdffa17
3 changed files with 32 additions and 13 deletions

View file

@ -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;
}