Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove masked_crates from clean::Crate #82960

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ crate struct Crate {
// These are later on moved into `CACHEKEY`, leaving the map empty.
// Only here so that they can be filtered through the rustdoc passes.
crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
crate masked_crates: FxHashSet<CrateNum>,
crate collapsed: bool,
}

Expand Down
5 changes: 1 addition & 4 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::clean::{
};
use crate::core::DocContext;

use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
Expand Down Expand Up @@ -38,7 +37,6 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
// Clean the crate, translating the entire librustc_ast AST to one that is
// understood by rustdoc.
let mut module = module.clean(cx);
let mut masked_crates = FxHashSet::default();

match *module.kind {
ItemKind::ModuleItem(ref module) => {
Expand All @@ -49,7 +47,7 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
&& (it.attrs.has_doc_flag(sym::masked)
|| cx.tcx.is_compiler_builtins(it.def_id.krate))
{
masked_crates.insert(it.def_id.krate);
cx.cache.masked_crates.insert(it.def_id.krate);
}
}
}
Expand Down Expand Up @@ -82,7 +80,6 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
externs,
primitives,
external_traits: cx.external_traits.clone(),
masked_crates,
collapsed: false,
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,16 @@ crate struct Cache {
/// This is stored in `Cache` so it doesn't need to be passed through all rustdoc functions.
crate document_private: bool,

/// Crates marked with [`#[doc(masked)]`][doc_masked].
///
/// [doc_masked]: https://doc.rust-lang.org/nightly/unstable-book/language-features/doc-masked.html
crate masked_crates: FxHashSet<CrateNum>,

// Private fields only used when initially crawling a crate to build a cache
stack: Vec<String>,
parent_stack: Vec<DefId>,
parent_is_trait_impl: bool,
stripped_mod: bool,
masked_crates: FxHashSet<CrateNum>,

crate search_index: Vec<IndexItem>,
crate deref_trait_did: Option<DefId>,
Expand Down Expand Up @@ -146,7 +150,6 @@ impl Cache {
// Crawl the crate to build various caches used for the output
debug!(?self.crate_version);
self.traits = krate.external_traits.take();
self.masked_crates = mem::take(&mut krate.masked_crates);

// Cache where all our extern crates are located
// FIXME: this part is specific to HTML so it'd be nice to remove it from the common code
Expand Down