File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
compiler/rustc_middle/src Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ rustc_queries! {
209209 /// Contrary to `def_span` below, this query returns the full absolute span of the definition.
210210 /// This span is meant for dep-tracking rather than diagnostics. It should not be used outside
211211 /// of rustc_middle::hir::source_map.
212- query source_span ( key: LocalDefId ) -> Span {
212+ query source_span_q ( key: LocalDefId ) -> Span {
213213 // Accesses untracked data
214214 eval_always
215215 desc { "getting the source span" }
Original file line number Diff line number Diff line change @@ -3518,6 +3518,15 @@ impl<'tcx> TyCtxt<'tcx> {
35183518 }
35193519 false
35203520 }
3521+
3522+ #[ inline]
3523+ pub fn source_span ( self , key : LocalDefId ) -> Span {
3524+ if self . dep_graph . is_fully_enabled ( ) {
3525+ self . source_span_q ( key)
3526+ } else {
3527+ self . untracked . source_span . get ( key) . unwrap_or ( DUMMY_SP )
3528+ }
3529+ }
35213530}
35223531
35233532/// Parameter attributes that can only be determined by examining the body of a function instead
@@ -3544,7 +3553,8 @@ pub fn provide(providers: &mut Providers) {
35443553 // We want to check if the panic handler was defined in this crate
35453554 tcx. lang_items ( ) . panic_impl ( ) . is_some_and ( |did| did. is_local ( ) )
35463555 } ;
3547- providers. source_span = |tcx, def_id| tcx. untracked . source_span . get ( def_id) . unwrap_or ( DUMMY_SP ) ;
3556+ providers. source_span_q =
3557+ |tcx, def_id| tcx. untracked . source_span . get ( def_id) . unwrap_or ( DUMMY_SP ) ;
35483558}
35493559
35503560pub fn contains_name ( attrs : & [ Attribute ] , name : Symbol ) -> bool {
You can’t perform that action at this time.
0 commit comments