diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 20b17afeab2f6..238a2bd3ba571 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -209,9 +209,6 @@ impl<'a, 'tcx, 'rcx, 'cstore> Clean for visit_ast::RustdocVisitor<'a, 'tc })); } - let mut access_levels = cx.access_levels.borrow_mut(); - let mut external_traits = cx.external_traits.borrow_mut(); - Crate { name, version: None, @@ -219,8 +216,8 @@ impl<'a, 'tcx, 'rcx, 'cstore> Clean for visit_ast::RustdocVisitor<'a, 'tc module: Some(module), externs, primitives, - access_levels: Arc::new(mem::replace(&mut access_levels, Default::default())), - external_traits: mem::replace(&mut external_traits, Default::default()), + access_levels: Arc::new(Default::default()), + external_traits: Default::default(), masked_crates, } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index d7e087fd62459..d6cdc48901cc8 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -41,6 +41,7 @@ use std::cell::RefCell; use std::mem; use rustc_data_structures::sync::{self, Lrc}; use std::rc::Rc; +use std::sync::Arc; use std::path::PathBuf; use visit_ast::RustdocVisitor; @@ -599,6 +600,9 @@ pub fn run_core(search_paths: SearchPaths, ctxt.sess().abort_if_errors(); + krate.access_levels = Arc::new(ctxt.access_levels.into_inner()); + krate.external_traits = ctxt.external_traits.into_inner(); + (krate, ctxt.renderinfo.into_inner(), passes) }), &sess) }) diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 0be5ab07dea76..0ee1657f21516 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -88,12 +88,5 @@ pub fn collect_trait_impls(mut krate: Crate, cx: &DocContext) -> Crate { panic!("collect-trait-impls can't run"); } - // pulling in the impls puts their trait info into the DocContext, but that's already been - // drained by now, so stuff that info into the Crate so the rendering can pick it up - let mut external_traits = cx.external_traits.borrow_mut(); - for (did, trait_) in external_traits.drain() { - krate.external_traits.entry(did).or_insert(trait_); - } - krate } diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index 3b17a768ffdee..4fa5943faca07 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -22,10 +22,10 @@ pub const STRIP_PRIVATE: Pass = /// Strip private items from the point of view of a crate or externally from a /// crate, specified by the `xcrate` flag. -pub fn strip_private(mut krate: clean::Crate, _: &DocContext) -> clean::Crate { +pub fn strip_private(mut krate: clean::Crate, cx: &DocContext) -> clean::Crate { // This stripper collects all *retained* nodes. let mut retained = DefIdSet(); - let access_levels = krate.access_levels.clone(); + let access_levels = cx.access_levels.borrow().clone(); // strip all private items {