Skip to content

Commit bbc3825

Browse files
committed
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.
1 parent 6c017f0 commit bbc3825

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/librustdoc/clean/utils.rs

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::clean::{
77
};
88
use crate::core::DocContext;
99
use crate::formats::item_type::ItemType;
10+
use crate::visit_lib::LibEmbargoVisitor;
1011

1112
use rustc_ast as ast;
1213
use rustc_ast::tokenstream::TokenTree;
@@ -26,6 +27,11 @@ mod tests;
2627
crate fn krate(cx: &mut DocContext<'_>) -> Crate {
2728
let module = crate::visit_ast::RustdocVisitor::new(cx).visit();
2829

30+
for &cnum in cx.tcx.crates(()) {
31+
// Analyze doc-reachability for extern items
32+
LibEmbargoVisitor::new(cx).visit_lib(cnum);
33+
}
34+
2935
// Clean the crate, translating the entire librustc_ast AST to one that is
3036
// understood by rustdoc.
3137
let mut module = module.clean(cx);

src/librustdoc/formats/cache.rs

-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::formats::Impl;
1414
use crate::html::markdown::short_markdown_summary;
1515
use crate::html::render::cache::{get_index_search_type, ExternalLocation};
1616
use crate::html::render::IndexItem;
17-
use crate::visit_lib::LibEmbargoVisitor;
1817

1918
/// This cache is used to store information about the [`clean::Crate`] being
2019
/// rendered in order to provide more useful documentation. This contains
@@ -148,8 +147,6 @@ impl Cache {
148147
// FIXME: this part is specific to HTML so it'd be nice to remove it from the common code
149148
for &crate_num in cx.tcx.crates(()) {
150149
let e = ExternalCrate { crate_num };
151-
// Analyze doc-reachability for extern items
152-
LibEmbargoVisitor::new(cx).visit_lib(e.crate_num);
153150

154151
let name = e.name(tcx);
155152
let render_options = &cx.render_options;

0 commit comments

Comments
 (0)