Skip to content

Commit

Permalink
only move access_levels/external_traits after early passes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Sep 20, 2018
1 parent 457efc1 commit 6aa7493
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
7 changes: 2 additions & 5 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,15 @@ impl<'a, 'tcx, 'rcx, 'cstore> Clean<Crate> 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,
src,
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,
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
})
Expand Down
7 changes: 0 additions & 7 deletions src/librustdoc/passes/collect_trait_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions src/librustdoc/passes/strip_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 6aa7493

Please sign in to comment.