about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-01-28 14:58:27 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-01-28 14:58:27 -0300
commitd17eb78cf836610d8571806744785f1cbcbb6481 (patch)
treef49c33ed8338e4da1711facb101e73b565ed9311 /compiler/rustc_middle/src/query
parenta0bcce4884683cd3cb968f6cf6dd0d7720e9a6db (diff)
downloadrust-d17eb78cf836610d8571806744785f1cbcbb6481.tar.gz
rust-d17eb78cf836610d8571806744785f1cbcbb6481.zip
Separate hir_owner query into two queries to avoid using extensive data on incr comp most of the time
Diffstat (limited to 'compiler/rustc_middle/src/query')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index f5b4925fbb3..2eadcc6c1d3 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -52,10 +52,18 @@ rustc_queries! {
     ///
     /// This can be conveniently accessed by methods on `tcx.hir()`.
     /// Avoid calling this query directly.
-    query hir_owner(key: LocalDefId) -> hir::MaybeOwner<crate::hir::Owner<'tcx>> {
+    query hir_owner(key: LocalDefId) -> Option<crate::hir::Owner<'tcx>> {
         desc { |tcx| "HIR owner of `{}`", tcx.def_path_str(key.to_def_id()) }
     }
 
+    /// Gives access to the HIR ID for the given `LocalDefId` owner `key`.
+    ///
+    /// This can be conveniently accessed by methods on `tcx.hir()`.
+    /// Avoid calling this query directly.
+    query local_def_id_to_hir_id(key: LocalDefId) -> hir::MaybeOwner<crate::hir::Owner<'tcx>> {
+        desc { |tcx| "HIR ID of `{}`", tcx.def_path_str(key.to_def_id()) }
+    }
+
     /// Gives access to the HIR node's parent for the HIR owner `key`.
     ///
     /// This can be conveniently accessed by methods on `tcx.hir()`.