Skip to content

Commit

Permalink
Remove source_span_untracked
Browse files Browse the repository at this point in the history
it only has one caller, and we can avoid query dep tracking and still call the query
  • Loading branch information
oli-obk committed Feb 14, 2023
1 parent e9ab787 commit db2679d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,13 +981,6 @@ impl<'tcx> TyCtxt<'tcx> {
self.untracked.definitions.read()
}

/// Note that this is *untracked* and should only be used within the query
/// system if the result is otherwise tracked through queries
#[inline]
pub fn source_span_untracked(self, def_id: LocalDefId) -> Span {
self.untracked.source_span.get(def_id).copied().unwrap_or(DUMMY_SP)
}

#[inline(always)]
pub fn with_stable_hashing_context<R>(
self,
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_query_impl/src/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span {
let dlo = u32::decode(decoder);
let dto = u32::decode(decoder);

let enclosing = decoder.tcx.source_span_untracked(parent.unwrap()).data_untracked();
let enclosing = decoder
.tcx
.dep_graph
.with_ignore(|| decoder.tcx.source_span(parent.unwrap()))
.data_untracked();
let span = Span::new(
enclosing.lo + BytePos::from_u32(dlo),
enclosing.lo + BytePos::from_u32(dto),
Expand Down

0 comments on commit db2679d

Please sign in to comment.