about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-01-25 19:16:38 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-01-30 15:00:52 +0300
commit64b6b5b6ce078684dea0d312e3ac0911e1d6a0df (patch)
tree0855baa9a6a74ccced8920fea0c6bf01bb0c68b8 /compiler/rustc_middle/src/query
parentc401f099795231fca8adf6619d76ccdcfbbfd2f9 (diff)
downloadrust-64b6b5b6ce078684dea0d312e3ac0911e1d6a0df.tar.gz
rust-64b6b5b6ce078684dea0d312e3ac0911e1d6a0df.zip
hir: Simplify `hir_owner_nodes` query
The query accept arbitrary DefIds, not just owner DefIds.
The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom.
Also rename the query to `opt_hir_owner_nodes`.
Diffstat (limited to 'compiler/rustc_middle/src/query')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 1122f571fff..658549e598e 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -190,11 +190,11 @@ rustc_queries! {
         desc { |tcx| "getting HIR parent of `{}`", tcx.def_path_str(key) }
     }
 
-    /// Gives access to the HIR nodes and bodies inside the HIR owner `key`.
+    /// Gives access to the HIR nodes and bodies inside `key` if it's a HIR owner.
     ///
     /// This can be conveniently accessed by methods on `tcx.hir()`.
     /// Avoid calling this query directly.
-    query hir_owner_nodes(key: hir::OwnerId) -> hir::MaybeOwner<&'tcx hir::OwnerNodes<'tcx>> {
+    query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> {
         desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) }
     }