1
Fork 0

Auto merge of #115657 - Zoxc:source-span-avoid-query, r=cjgillot

Avoid a `source_span` query when encoding Spans into query results

This avoids a `source_span` query when encoding `Span`s into query results. It's not sound to execute queries here as the query caches can be locked and the dep graph is no longer writable.

r? `@cjgillot`
This commit is contained in:
bors 2023-09-09 09:08:54 +00:00
commit 38bbc2ce03
2 changed files with 15 additions and 13 deletions

View file

@ -896,7 +896,7 @@ impl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx>> for Span {
}
if let Some(parent) = span_data.parent {
let enclosing = s.tcx.source_span(parent).data_untracked();
let enclosing = s.tcx.source_span_untracked(parent).data_untracked();
if enclosing.contains(span_data) {
TAG_RELATIVE_SPAN.encode(s);
(span_data.lo - enclosing.lo).to_u32().encode(s);