Skip to content

Commit

Permalink
rustdoc: Move doc-reachability visiting back to cleaning
Browse files Browse the repository at this point in the history
It populates `cx.cache.access_levels`, which seems to be needed during
cleaning since a bunch of tests are failing.
  • Loading branch information
camelid committed Nov 20, 2021
1 parent 6c017f0 commit bbc3825
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/librustdoc/clean/utils.rs
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/librustdoc/formats/cache.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit bbc3825

Please sign in to comment.