]> git.lizzy.rs Git - rust.git/commitdiff
Add some comments to the new queries
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Wed, 11 Mar 2020 14:20:24 +0000 (15:20 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Sat, 14 Mar 2020 21:52:31 +0000 (22:52 +0100)
src/librustc/query/mod.rs

index 866fe8c88a858bbce29b4d5f5b14400f3a23e31a..ff3a82e53639e38133ff8f9d58e006477c45004d 100644 (file)
@@ -55,20 +55,33 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
             desc { "get the crate HIR" }
         }
 
+        // The indexed HIR. This can be conveniently accessed by `tcx.hir()`.
+        // Avoid calling this query directly.
         query index_hir(_: CrateNum) -> &'tcx map::IndexedHir<'tcx> {
             eval_always
             no_hash
             desc { "index HIR" }
         }
 
+        // The items in a module.
+        // This can be conveniently accessed by `tcx.hir().visit_item_likes_in_module`.
+        // Avoid calling this query directly.
         query hir_module_items(key: DefId) -> &'tcx hir::ModuleItems {
             eval_always
         }
 
+        // An HIR item with a `DefId` that can own other HIR items which do not themselves have
+        // a `DefId`.
+        // This can be conveniently accessed by methods on `tcx.hir()`.
+        // Avoid calling this query directly.
         query hir_owner(key: DefId) -> &'tcx HirOwner<'tcx> {
             eval_always
         }
 
+        // The HIR items which do not themselves have a `DefId` and are owned by another HIR item
+        // with a `DefId`.
+        // This can be conveniently accessed by methods on `tcx.hir()`.
+        // Avoid calling this query directly.
         query hir_owner_items(key: DefId) -> &'tcx HirOwnerItems<'tcx> {
             eval_always
         }