@@ -7,6 +7,7 @@ use crate::hir::def_id::{DefId, LocalDefId, CrateNum, CRATE_DEF_INDEX};
7
7
use crate :: ich:: { StableHashingContext , NodeIdHashingMode , Fingerprint } ;
8
8
use rustc_data_structures:: stable_hasher:: { HashStable , ToStableHashKey ,
9
9
StableHasher , StableHasherResult } ;
10
+ use smallvec:: SmallVec ;
10
11
use std:: mem;
11
12
use syntax:: ast;
12
13
use syntax:: attr;
@@ -397,14 +398,13 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitCandidate {
397
398
} = self ;
398
399
399
400
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) ;
402
402
} ) ;
403
403
}
404
404
}
405
405
406
406
impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for hir:: TraitCandidate {
407
- type KeyType = ( DefPathHash , Option < ( DefPathHash , hir:: ItemLocalId ) > ) ;
407
+ type KeyType = ( DefPathHash , SmallVec < [ ( DefPathHash , hir:: ItemLocalId ) ; 1 ] > ) ;
408
408
409
409
fn to_stable_hash_key ( & self ,
410
410
hcx : & StableHashingContext < ' a > )
@@ -414,10 +414,10 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
414
414
import_ids,
415
415
} = self ;
416
416
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) )
418
418
. 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 )
421
421
}
422
422
}
423
423
0 commit comments