1
Fork 0

refactor: move access_levels into RenderInfo

This commit is contained in:
QuietMisdreavus 2018-08-30 16:46:10 -05:00
parent 87760e5f5e
commit c754e8240c
8 changed files with 19 additions and 19 deletions

View file

@ -69,7 +69,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
let real_name = name.clone().map(|name| Ident::from_str(&name));
let param_env = self.cx.tcx.param_env(def_id);
for &trait_def_id in self.cx.all_traits.iter() {
if !self.cx.access_levels.borrow().is_doc_reachable(trait_def_id) ||
if !self.cx.renderinfo.borrow().access_levels.is_doc_reachable(trait_def_id) ||
self.cx.generated_synthetics
.borrow_mut()
.get(&(def_id, trait_def_id))

View file

@ -297,7 +297,7 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
// reachable in rustdoc generated documentation
if !did.is_local() {
if let Some(traitref) = associated_trait {
if !cx.access_levels.borrow().is_doc_reachable(traitref.def_id) {
if !cx.renderinfo.borrow().access_levels.is_doc_reachable(traitref.def_id) {
return
}
}
@ -318,7 +318,7 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
// reachable in rustdoc generated documentation
if !did.is_local() {
if let Some(did) = for_.def_id() {
if !cx.access_levels.borrow().is_doc_reachable(did) {
if !cx.renderinfo.borrow().access_levels.is_doc_reachable(did) {
return
}
}

View file

@ -28,7 +28,6 @@ use syntax::symbol::InternedString;
use syntax_pos::{self, DUMMY_SP, Pos, FileName};
use rustc::mir::interpret::ConstValue;
use rustc::middle::privacy::AccessLevels;
use rustc::middle::resolve_lifetime as rl;
use rustc::ty::fold::TypeFolder;
use rustc::middle::lang_items;
@ -135,7 +134,6 @@ pub struct Crate {
pub module: Option<Item>,
pub externs: Vec<(CrateNum, ExternalCrate)>,
pub primitives: Vec<(DefId, PrimitiveType, Attributes)>,
pub access_levels: Arc<AccessLevels<DefId>>,
// These are later on moved into `CACHEKEY`, leaving the map empty.
// Only here so that they can be filtered through the rustdoc passes.
pub external_traits: FxHashMap<DefId, Trait>,
@ -216,7 +214,6 @@ impl<'a, 'tcx, 'rcx, 'cstore> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tc
module: Some(module),
externs,
primitives,
access_levels: Arc::new(Default::default()),
external_traits: Default::default(),
masked_crates,
}
@ -2433,7 +2430,7 @@ impl Clean<Type> for hir::Ty {
if let Def::TyAlias(def_id) = path.def {
// Substitute private type aliases
if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) {
if !cx.access_levels.borrow().is_exported(def_id) {
if !cx.renderinfo.borrow().access_levels.is_exported(def_id) {
alias = Some(&cx.tcx.hir.expect_item(node_id).node);
}
}