11use std:: mem;
22
3- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
3+ use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet } ;
44use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , DefIdSet } ;
55use rustc_middle:: ty:: { self , TyCtxt } ;
66use rustc_span:: Symbol ;
@@ -42,7 +42,7 @@ pub(crate) struct Cache {
4242 /// URLs when a type is being linked to. External paths are not located in
4343 /// this map because the `External` type itself has all the information
4444 /// necessary.
45- pub ( crate ) paths : FxHashMap < DefId , ( Vec < Symbol > , ItemType ) > ,
45+ pub ( crate ) paths : FxIndexMap < DefId , ( Vec < Symbol > , ItemType ) > ,
4646
4747 /// Similar to `paths`, but only holds external paths. This is only used for
4848 /// generating explicit hyperlinks to other crates.
@@ -64,18 +64,18 @@ pub(crate) struct Cache {
6464 /// Implementations of a crate should inherit the documentation of the
6565 /// parent trait if no extra documentation is specified, and default methods
6666 /// should show up in documentation about trait implementations.
67- pub ( crate ) traits : FxHashMap < DefId , clean:: Trait > ,
67+ pub ( crate ) traits : FxIndexMap < DefId , clean:: Trait > ,
6868
6969 /// When rendering traits, it's often useful to be able to list all
7070 /// implementors of the trait, and this mapping is exactly, that: a mapping
7171 /// of trait ids to the list of known implementors of the trait
72- pub ( crate ) implementors : FxHashMap < DefId , Vec < Impl > > ,
72+ pub ( crate ) implementors : FxIndexMap < DefId , Vec < Impl > > ,
7373
7474 /// Cache of where external crate documentation can be found.
75- pub ( crate ) extern_locations : FxHashMap < CrateNum , ExternalLocation > ,
75+ pub ( crate ) extern_locations : FxIndexMap < CrateNum , ExternalLocation > ,
7676
7777 /// Cache of where documentation for primitives can be found.
78- pub ( crate ) primitive_locations : FxHashMap < clean:: PrimitiveType , DefId > ,
78+ pub ( crate ) primitive_locations : FxIndexMap < clean:: PrimitiveType , DefId > ,
7979
8080 // Note that external items for which `doc(hidden)` applies to are shown as
8181 // non-reachable while local items aren't. This is because we're reusing
@@ -118,7 +118,7 @@ pub(crate) struct Cache {
118118 // crawl. In order to prevent crashes when looking for notable traits or
119119 // when gathering trait documentation on a type, hold impls here while
120120 // folding and add them to the cache later on if we find the trait.
121- orphan_trait_impls : Vec < ( DefId , FxHashSet < DefId > , Impl ) > ,
121+ orphan_trait_impls : Vec < ( DefId , FxIndexSet < DefId > , Impl ) > ,
122122
123123 /// All intra-doc links resolved so far.
124124 ///
@@ -376,7 +376,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
376376 // Figure out the id of this impl. This may map to a
377377 // primitive rather than always to a struct/enum.
378378 // Note: matching twice to restrict the lifetime of the `i` borrow.
379- let mut dids = FxHashSet :: default ( ) ;
379+ let mut dids = FxIndexSet :: default ( ) ;
380380 match i. for_ {
381381 clean:: Type :: Path { ref path }
382382 | clean:: BorrowedRef { type_ : box clean:: Type :: Path { ref path } , .. } => {
0 commit comments