about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/mod.rs
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-07-04 07:47:53 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-07-07 08:13:12 +0000
commit62929b9420da2c2b1357d392572e786e3990ca0c (patch)
tree97a034e48ce0a0cc2a91555c0337cbbf27d7c999 /compiler/rustc_middle/src/query/mod.rs
parent0d11be5aabe0cd49609fff5fce57c4691a22fe55 (diff)
downloadrust-62929b9420da2c2b1357d392572e786e3990ca0c.tar.gz
rust-62929b9420da2c2b1357d392572e786e3990ca0c.zip
Add `ty_span` query
Diffstat (limited to 'compiler/rustc_middle/src/query/mod.rs')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 17a29c9ae4b..9af5683ff75 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -1452,6 +1452,13 @@ rustc_queries! {
         feedable
     }
 
+    /// Gets the span for the type of the definition.
+    /// Panics if it is not a definition that has a single type.
+    query ty_span(def_id: LocalDefId) -> Span {
+        desc { |tcx| "looking up span for `{}`'s type", tcx.def_path_str(def_id) }
+        cache_on_disk_if { true }
+    }
+
     query lookup_stability(def_id: DefId) -> Option<attr::Stability> {
         desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
         cache_on_disk_if { def_id.is_local() }