From db2679d1b58860bb1c5c3871cdfa019826665c4f Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 14 Feb 2023 10:48:30 +0000 Subject: [PATCH] Remove `source_span_untracked` it only has one caller, and we can avoid query dep tracking and still call the query --- compiler/rustc_middle/src/ty/context.rs | 7 ------- compiler/rustc_query_impl/src/on_disk_cache.rs | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 02088fffeb6c3..b44cba62143f6 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -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( self, diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index 70c481fb0ee2e..ac454e7d9dbf5 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -695,7 +695,11 @@ impl<'a, 'tcx> Decodable> 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),