diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2021-11-19 22:00:37 -0500 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2021-11-19 22:00:37 -0500 |
| commit | bbc3825d26c0cdef066ca6aa665f85241befc3d0 (patch) | |
| tree | 491d781acd3bfbf2056e025fb53c457335e1d782 /src | |
| parent | 6c017f071d5894a75c3cb37aa48791e77f50a8f2 (diff) | |
| download | rust-bbc3825d26c0cdef066ca6aa665f85241befc3d0.tar.gz rust-bbc3825d26c0cdef066ca6aa665f85241befc3d0.zip | |
rustdoc: Move doc-reachability visiting back to cleaning
It populates `cx.cache.access_levels`, which seems to be needed during cleaning since a bunch of tests are failing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 69f908b5851..9860b21e0a9 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -7,6 +7,7 @@ use crate::clean::{ }; use crate::core::DocContext; use crate::formats::item_type::ItemType; +use crate::visit_lib::LibEmbargoVisitor; use rustc_ast as ast; use rustc_ast::tokenstream::TokenTree; @@ -26,6 +27,11 @@ mod tests; crate fn krate(cx: &mut DocContext<'_>) -> Crate { let module = crate::visit_ast::RustdocVisitor::new(cx).visit(); + for &cnum in cx.tcx.crates(()) { + // Analyze doc-reachability for extern items + LibEmbargoVisitor::new(cx).visit_lib(cnum); + } + // Clean the crate, translating the entire librustc_ast AST to one that is // understood by rustdoc. let mut module = module.clean(cx); diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index a5c9370c05c..db2b836de86 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -14,7 +14,6 @@ use crate::formats::Impl; use crate::html::markdown::short_markdown_summary; use crate::html::render::cache::{get_index_search_type, ExternalLocation}; use crate::html::render::IndexItem; -use crate::visit_lib::LibEmbargoVisitor; /// This cache is used to store information about the [`clean::Crate`] being /// rendered in order to provide more useful documentation. This contains @@ -148,8 +147,6 @@ impl Cache { // FIXME: this part is specific to HTML so it'd be nice to remove it from the common code for &crate_num in cx.tcx.crates(()) { let e = ExternalCrate { crate_num }; - // Analyze doc-reachability for extern items - LibEmbargoVisitor::new(cx).visit_lib(e.crate_num); let name = e.name(tcx); let render_options = &cx.render_options; |
