@@ -14,7 +14,6 @@ use rustc_driver::{driver, target_features, abort_on_err};
14
14
use rustc:: dep_graph:: DepGraph ;
15
15
use rustc:: session:: { self , config} ;
16
16
use rustc:: hir:: def_id:: DefId ;
17
- use rustc:: middle:: cstore:: LOCAL_CRATE ;
18
17
use rustc:: middle:: privacy:: AccessLevels ;
19
18
use rustc:: ty:: { self , TyCtxt } ;
20
19
use rustc:: hir:: map as hir_map;
@@ -30,7 +29,7 @@ use syntax::feature_gate::UnstableFeatures;
30
29
use syntax:: parse:: token;
31
30
32
31
use std:: cell:: { RefCell , Cell } ;
33
- use std:: collections:: { HashMap , HashSet } ;
32
+ use std:: collections:: HashMap ;
34
33
use std:: rc:: Rc ;
35
34
36
35
use visit_ast:: RustdocVisitor ;
@@ -47,6 +46,7 @@ pub enum MaybeTyped<'a, 'tcx: 'a> {
47
46
NotTyped ( & ' a session:: Session )
48
47
}
49
48
49
+ pub type Externs = HashMap < String , Vec < String > > ;
50
50
pub type ExternalPaths = HashMap < DefId , ( Vec < String > , clean:: TypeKind ) > ;
51
51
52
52
pub struct DocContext < ' a , ' tcx : ' a > {
@@ -55,8 +55,6 @@ pub struct DocContext<'a, 'tcx: 'a> {
55
55
pub input : Input ,
56
56
pub all_crate_impls : RefCell < HashMap < ast:: CrateNum , Vec < clean:: Item > > > ,
57
57
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 > > ,
60
58
// Note that external items for which `doc(hidden)` applies to are shown as
61
59
// non-reachable while local items aren't. This is because we're reusing
62
60
// the access levels from crateanalysis.
@@ -89,7 +87,16 @@ impl<'b, 'tcx> DocContext<'b, 'tcx> {
89
87
}
90
88
}
91
89
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
+
93
100
94
101
pub fn run_core ( search_paths : SearchPaths ,
95
102
cfgs : Vec < String > ,
@@ -172,16 +179,13 @@ pub fn run_core(search_paths: SearchPaths,
172
179
. map ( |( k, v) | ( tcx. map . local_def_id ( k) , v) )
173
180
. collect ( )
174
181
} ;
175
- let mut analyzed_crates = HashSet :: new ( ) ;
176
- analyzed_crates. insert ( LOCAL_CRATE ) ;
177
182
178
183
let ctxt = DocContext {
179
184
map : & tcx. map ,
180
185
maybe_typed : Typed ( tcx) ,
181
186
input : input,
182
187
all_crate_impls : RefCell :: new ( HashMap :: new ( ) ) ,
183
188
deref_trait_did : Cell :: new ( None ) ,
184
- analyzed_crates : RefCell :: new ( analyzed_crates) ,
185
189
access_levels : RefCell :: new ( access_levels) ,
186
190
external_traits : RefCell :: new ( HashMap :: new ( ) ) ,
187
191
renderinfo : RefCell :: new ( Default :: default ( ) ) ,
0 commit comments