@@ -7,6 +7,7 @@ use crate::hir::def_id::{DefId, LocalDefId, CrateNum, CRATE_DEF_INDEX};
77use crate :: ich:: { StableHashingContext , NodeIdHashingMode , Fingerprint } ;
88use rustc_data_structures:: stable_hasher:: { HashStable , ToStableHashKey ,
99 StableHasher , StableHasherResult } ;
10+ use smallvec:: SmallVec ;
1011use std:: mem;
1112use syntax:: ast;
1213use syntax:: attr;
@@ -397,14 +398,13 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitCandidate {
397398 } = self ;
398399
399400 def_id. hash_stable ( hcx, hasher) ;
400- // We only use the outermost import NodeId as key
401- import_ids. first ( ) . hash_stable ( hcx, hasher) ;
401+ import_ids. hash_stable ( hcx, hasher) ;
402402 } ) ;
403403 }
404404}
405405
406406impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for hir:: TraitCandidate {
407- type KeyType = ( DefPathHash , Option < ( DefPathHash , hir:: ItemLocalId ) > ) ;
407+ type KeyType = ( DefPathHash , SmallVec < [ ( DefPathHash , hir:: ItemLocalId ) ; 1 ] > ) ;
408408
409409 fn to_stable_hash_key ( & self ,
410410 hcx : & StableHashingContext < ' a > )
@@ -414,10 +414,10 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
414414 import_ids,
415415 } = self ;
416416
417- let first_import_id = import_ids. first ( ) . map ( |node_id| hcx. node_to_hir_id ( * node_id) )
417+ let import_keys = import_ids. iter ( ) . map ( |node_id| hcx. node_to_hir_id ( * node_id) )
418418 . map ( |hir_id| ( hcx. local_def_path_hash ( hir_id. owner ) ,
419- hir_id. local_id ) ) ;
420- ( hcx. def_path_hash ( * def_id) , first_import_id )
419+ hir_id. local_id ) ) . collect ( ) ;
420+ ( hcx. def_path_hash ( * def_id) , import_keys )
421421 }
422422}
423423
0 commit comments