@@ -9,7 +9,7 @@ use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
9
9
use rustc_middle:: middle:: privacy:: AccessLevels ;
10
10
use rustc_span:: source_map:: FileName ;
11
11
12
- use crate :: clean:: { self , GetDefId } ;
12
+ use crate :: clean:: { self , primitives , GetDefId } ;
13
13
use crate :: config:: RenderInfo ;
14
14
use crate :: fold:: DocFolder ;
15
15
use crate :: formats:: item_type:: ItemType ;
@@ -76,9 +76,6 @@ pub struct Cache {
76
76
/// Cache of where external crate documentation can be found.
77
77
pub extern_locations : FxHashMap < CrateNum , ( String , PathBuf , ExternalLocation ) > ,
78
78
79
- /// Cache of where documentation for primitives can be found.
80
- pub primitive_locations : FxHashMap < clean:: PrimitiveType , DefId > ,
81
-
82
79
// Note that external items for which `doc(hidden)` applies to are shown as
83
80
// non-reachable while local items aren't. This is because we're reusing
84
81
// the access levels from the privacy check pass.
@@ -182,19 +179,6 @@ impl Cache {
182
179
cache. external_paths . insert ( did, ( vec ! [ e. name. to_string( ) ] , ItemType :: Module ) ) ;
183
180
}
184
181
185
- // Cache where all known primitives have their documentation located.
186
- //
187
- // Favor linking to as local extern as possible, so iterate all crates in
188
- // reverse topological order.
189
- for & ( _, ref e) in krate. externs . iter ( ) . rev ( ) {
190
- for & ( def_id, prim, _) in & e. primitives {
191
- cache. primitive_locations . insert ( prim, def_id) ;
192
- }
193
- }
194
- for & ( def_id, prim, _) in & krate. primitives {
195
- cache. primitive_locations . insert ( prim, def_id) ;
196
- }
197
-
198
182
cache. stack . push ( krate. name . clone ( ) ) ;
199
183
krate = cache. fold_crate ( krate) ;
200
184
@@ -403,9 +387,8 @@ impl DocFolder for Cache {
403
387
true
404
388
}
405
389
ref t => {
406
- let prim_did = t
407
- . primitive_type ( )
408
- . and_then ( |t| self . primitive_locations . get ( & t) . cloned ( ) ) ;
390
+ let prim_did =
391
+ t. primitive_type ( ) . and_then ( |t| primitives ( ) . get ( & t) . cloned ( ) ) ;
409
392
match prim_did {
410
393
Some ( did) => {
411
394
self . parent_stack . push ( did) ;
@@ -436,9 +419,8 @@ impl DocFolder for Cache {
436
419
dids. insert ( did) ;
437
420
}
438
421
ref t => {
439
- let did = t
440
- . primitive_type ( )
441
- . and_then ( |t| self . primitive_locations . get ( & t) . cloned ( ) ) ;
422
+ let did =
423
+ t. primitive_type ( ) . and_then ( |t| primitives ( ) . get ( & t) . cloned ( ) ) ;
442
424
443
425
if let Some ( did) = did {
444
426
dids. insert ( did) ;
0 commit comments