Hash all of the import_ids for the TraitCandidate.
This commit is contained in:
parent
fc34d5f608
commit
6802082039
2 changed files with 18 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ use crate::hir::def_id::{DefId, LocalDefId, CrateNum, CRATE_DEF_INDEX};
|
|||
use crate::ich::{StableHashingContext, NodeIdHashingMode, Fingerprint};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
|
||||
StableHasher, StableHasherResult};
|
||||
use smallvec::SmallVec;
|
||||
use std::mem;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
|
|
@ -397,14 +398,13 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitCandidate {
|
|||
} = self;
|
||||
|
||||
def_id.hash_stable(hcx, hasher);
|
||||
// We only use the outermost import NodeId as key
|
||||
import_ids.first().hash_stable(hcx, hasher);
|
||||
import_ids.hash_stable(hcx, hasher);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
|
||||
type KeyType = (DefPathHash, Option<(DefPathHash, hir::ItemLocalId)>);
|
||||
type KeyType = (DefPathHash, SmallVec<[(DefPathHash, hir::ItemLocalId); 1]>);
|
||||
|
||||
fn to_stable_hash_key(&self,
|
||||
hcx: &StableHashingContext<'a>)
|
||||
|
|
@ -414,10 +414,10 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
|
|||
import_ids,
|
||||
} = self;
|
||||
|
||||
let first_import_id = import_ids.first().map(|node_id| hcx.node_to_hir_id(*node_id))
|
||||
let import_keys = import_ids.iter().map(|node_id| hcx.node_to_hir_id(*node_id))
|
||||
.map(|hir_id| (hcx.local_def_path_hash(hir_id.owner),
|
||||
hir_id.local_id));
|
||||
(hcx.def_path_hash(*def_id), first_import_id)
|
||||
hir_id.local_id)).collect();
|
||||
(hcx.def_path_hash(*def_id), import_keys)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue