@@ -9,7 +9,7 @@ use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
99use rustc_middle:: middle:: privacy:: AccessLevels ;
1010use rustc_span:: source_map:: FileName ;
1111
12- use crate :: clean:: { self , GetDefId } ;
12+ use crate :: clean:: { self , primitives , GetDefId } ;
1313use crate :: config:: RenderInfo ;
1414use crate :: fold:: DocFolder ;
1515use crate :: formats:: item_type:: ItemType ;
@@ -76,9 +76,6 @@ pub struct Cache {
7676 /// Cache of where external crate documentation can be found.
7777 pub extern_locations : FxHashMap < CrateNum , ( String , PathBuf , ExternalLocation ) > ,
7878
79- /// Cache of where documentation for primitives can be found.
80- pub primitive_locations : FxHashMap < clean:: PrimitiveType , DefId > ,
81-
8279 // Note that external items for which `doc(hidden)` applies to are shown as
8380 // non-reachable while local items aren't. This is because we're reusing
8481 // the access levels from the privacy check pass.
@@ -182,19 +179,6 @@ impl Cache {
182179 cache. external_paths . insert ( did, ( vec ! [ e. name. to_string( ) ] , ItemType :: Module ) ) ;
183180 }
184181
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-
198182 cache. stack . push ( krate. name . clone ( ) ) ;
199183 krate = cache. fold_crate ( krate) ;
200184
@@ -403,9 +387,8 @@ impl DocFolder for Cache {
403387 true
404388 }
405389 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 ( ) ) ;
409392 match prim_did {
410393 Some ( did) => {
411394 self . parent_stack . push ( did) ;
@@ -436,9 +419,8 @@ impl DocFolder for Cache {
436419 dids. insert ( did) ;
437420 }
438421 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 ( ) ) ;
442424
443425 if let Some ( did) = did {
444426 dids. insert ( did) ;
0 commit comments