@@ -50,8 +50,8 @@ use util::nodemap::{NodeMap, NodeSet, DefIdSet, ItemLocalMap};
5050use util:: nodemap:: { FxHashMap , FxHashSet } ;
5151use rustc_data_structures:: accumulate_vec:: AccumulateVec ;
5252use rustc_data_structures:: stable_hasher:: { HashStable , hash_stable_hashmap,
53- StableHasher , StableHasherResult } ;
54-
53+ StableHasher , StableHasherResult ,
54+ StableVec } ;
5555use arena:: { TypedArena , DroplessArena } ;
5656use rustc_const_math:: { ConstInt , ConstUsize } ;
5757use rustc_data_structures:: indexed_vec:: IndexVec ;
@@ -828,7 +828,9 @@ pub struct GlobalCtxt<'tcx> {
828828
829829 /// Map indicating what traits are in scope for places where this
830830 /// is relevant; generated by resolve.
831- trait_map : FxHashMap < DefIndex , Rc < FxHashMap < ItemLocalId , Rc < Vec < TraitCandidate > > > > > ,
831+ trait_map : FxHashMap < DefIndex ,
832+ Rc < FxHashMap < ItemLocalId ,
833+ Rc < StableVec < TraitCandidate > > > > > ,
832834
833835 /// Export map produced by name resolution.
834836 export_map : FxHashMap < DefId , Rc < Vec < Export > > > ,
@@ -1081,15 +1083,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
10811083 None
10821084 } ;
10831085
1084- // FIXME(mw): Each of the Vecs in the trait_map should be brought into
1085- // a deterministic order here. Otherwise we might end up with
1086- // unnecessarily unstable incr. comp. hashes.
10871086 let mut trait_map = FxHashMap ( ) ;
10881087 for ( k, v) in resolutions. trait_map {
10891088 let hir_id = hir. node_to_hir_id ( k) ;
10901089 let map = trait_map. entry ( hir_id. owner )
10911090 . or_insert_with ( || Rc :: new ( FxHashMap ( ) ) ) ;
1092- Rc :: get_mut ( map) . unwrap ( ) . insert ( hir_id. local_id , Rc :: new ( v) ) ;
1091+ Rc :: get_mut ( map) . unwrap ( )
1092+ . insert ( hir_id. local_id ,
1093+ Rc :: new ( StableVec :: new ( v) ) ) ;
10931094 }
10941095 let mut defs = FxHashMap ( ) ;
10951096 for ( k, v) in named_region_map. defs {
@@ -2103,7 +2104,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
21032104 lint:: struct_lint_level ( self . sess , lint, level, src, None , msg)
21042105 }
21052106
2106- pub fn in_scope_traits ( self , id : HirId ) -> Option < Rc < Vec < TraitCandidate > > > {
2107+ pub fn in_scope_traits ( self , id : HirId ) -> Option < Rc < StableVec < TraitCandidate > > > {
21072108 self . in_scope_traits_map ( id. owner )
21082109 . and_then ( |map| map. get ( & id. local_id ) . cloned ( ) )
21092110 }
0 commit comments