@@ -14,7 +14,6 @@ use rustc_driver::{driver, target_features, abort_on_err};
1414use rustc:: dep_graph:: DepGraph ;
1515use rustc:: session:: { self , config} ;
1616use rustc:: hir:: def_id:: DefId ;
17- use rustc:: middle:: cstore:: LOCAL_CRATE ;
1817use rustc:: middle:: privacy:: AccessLevels ;
1918use rustc:: ty:: { self , TyCtxt } ;
2019use rustc:: hir:: map as hir_map;
@@ -30,7 +29,7 @@ use syntax::feature_gate::UnstableFeatures;
3029use syntax:: parse:: token;
3130
3231use std:: cell:: { RefCell , Cell } ;
33- use std:: collections:: { HashMap , HashSet } ;
32+ use std:: collections:: HashMap ;
3433use std:: rc:: Rc ;
3534
3635use visit_ast:: RustdocVisitor ;
@@ -47,6 +46,7 @@ pub enum MaybeTyped<'a, 'tcx: 'a> {
4746 NotTyped ( & ' a session:: Session )
4847}
4948
49+ pub type Externs = HashMap < String , Vec < String > > ;
5050pub type ExternalPaths = HashMap < DefId , ( Vec < String > , clean:: TypeKind ) > ;
5151
5252pub struct DocContext < ' a , ' tcx : ' a > {
@@ -55,8 +55,6 @@ pub struct DocContext<'a, 'tcx: 'a> {
5555 pub input : Input ,
5656 pub all_crate_impls : RefCell < HashMap < ast:: CrateNum , Vec < clean:: Item > > > ,
5757 pub deref_trait_did : Cell < Option < DefId > > ,
58- /// Crates which have already been processed for `Self.access_levels`
59- pub analyzed_crates : RefCell < HashSet < ast:: CrateNum > > ,
6058 // Note that external items for which `doc(hidden)` applies to are shown as
6159 // non-reachable while local items aren't. This is because we're reusing
6260 // the access levels from crateanalysis.
@@ -89,7 +87,16 @@ impl<'b, 'tcx> DocContext<'b, 'tcx> {
8987 }
9088}
9189
92- pub type Externs = HashMap < String , Vec < String > > ;
90+ pub trait DocAccessLevels {
91+ fn is_doc_reachable ( & self , DefId ) -> bool ;
92+ }
93+
94+ impl DocAccessLevels for AccessLevels < DefId > {
95+ fn is_doc_reachable ( & self , did : DefId ) -> bool {
96+ self . is_public ( did)
97+ }
98+ }
99+
93100
94101pub fn run_core ( search_paths : SearchPaths ,
95102 cfgs : Vec < String > ,
@@ -172,16 +179,13 @@ pub fn run_core(search_paths: SearchPaths,
172179 . map ( |( k, v) | ( tcx. map . local_def_id ( k) , v) )
173180 . collect ( )
174181 } ;
175- let mut analyzed_crates = HashSet :: new ( ) ;
176- analyzed_crates. insert ( LOCAL_CRATE ) ;
177182
178183 let ctxt = DocContext {
179184 map : & tcx. map ,
180185 maybe_typed : Typed ( tcx) ,
181186 input : input,
182187 all_crate_impls : RefCell :: new ( HashMap :: new ( ) ) ,
183188 deref_trait_did : Cell :: new ( None ) ,
184- analyzed_crates : RefCell :: new ( analyzed_crates) ,
185189 access_levels : RefCell :: new ( access_levels) ,
186190 external_traits : RefCell :: new ( HashMap :: new ( ) ) ,
187191 renderinfo : RefCell :: new ( Default :: default ( ) ) ,
0 commit comments