about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-09-05 21:40:34 +0000
committerbors <bors@rust-lang.org>2021-09-05 21:40:34 +0000
commit7849e3e9dda60e8ec826ee245c6b180e73911b37 (patch)
treed10bb20b5a49755a917bc020cc1a55ccc6203ff7 /src/librustdoc/html
parente30b68353fe22b00f40d021e7914eeb78473b3c1 (diff)
parentd119a131374b973f0a1ae9d723c3a9ad518b8049 (diff)
downloadrust-7849e3e9dda60e8ec826ee245c6b180e73911b37.tar.gz
rust-7849e3e9dda60e8ec826ee245c6b180e73911b37.zip
Auto merge of #88435 - cjgillot:no-walk-crate, r=Aaron1011
Avoid invoking the hir_crate query to traverse the HIR

Walking the HIR tree is done using the `hir_crate` query. However, this is unnecessary, since `hir_owner(CRATE_DEF_ID)` provides the same information. Since depending on `hir_crate` forces dependents to always be executed, this leads to unnecessary work.

By splitting HIR and attributes visits, we can avoid an edge to `hir_crate` when trying to visit the HIR tree.
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/span_map.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs
index b35cd45dc9a..54476d9c9a4 100644
--- a/src/librustdoc/html/render/span_map.rs
+++ b/src/librustdoc/html/render/span_map.rs
@@ -45,7 +45,7 @@ crate fn collect_spans_and_sources(
 
     if include_sources {
         if generate_link_to_definition {
-            intravisit::walk_crate(&mut visitor, tcx.hir().krate());
+            tcx.hir().walk_toplevel_module(&mut visitor);
         }
         let (krate, sources) = sources::collect_local_sources(tcx, src_root, krate);
         (krate, sources, visitor.matches)