]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/query/mod.rs
Move the `krate` method to Hir and remove the Krate dep node
[rust.git] / src / librustc / query / mod.rs
index f0ea9ee7b196aaba900d5c1790b4f8b389ae813d..82ff7da13aea85fd24ad4bbeab2bf04d405ad9ca 100644 (file)
@@ -43,6 +43,12 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
     }
 
     Other {
+        // Represents crate as a whole (as distinct from the to-level crate module).
+        // If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
+        // we will have to assume that any change means that you need to be recompiled.
+        // This is because the `hir_crate` query gives you access to all other items.
+        // To avoid this fate, do not call `tcx.hir().krate()`; instead,
+        // prefer wrappers like `tcx.visit_all_items_in_krate()`.
         query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
             eval_always
             no_hash