Skip to content

Commit 8ab4e63

Browse files
committed
Hash less while hashing def-ids.
1 parent b931e41 commit 8ab4e63

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/rustc_span/src/def_id.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl DefPathHash {
110110

111111
/// Builds a new [DefPathHash] with the given [StableCrateId] and
112112
/// `local_hash`, where `local_hash` must be unique within its crate.
113+
#[inline]
113114
pub fn new(stable_crate_id: StableCrateId, local_hash: Hash64) -> DefPathHash {
114115
DefPathHash(Fingerprint::new(stable_crate_id.0, local_hash))
115116
}
@@ -404,21 +405,21 @@ rustc_data_structures::define_id_collections!(
404405
impl<CTX: HashStableContext> HashStable<CTX> for DefId {
405406
#[inline]
406407
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
407-
self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
408+
hcx.def_path_hash(*self).hash_stable(hcx, hasher);
408409
}
409410
}
410411

411412
impl<CTX: HashStableContext> HashStable<CTX> for LocalDefId {
412413
#[inline]
413414
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
414-
self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
415+
hcx.def_path_hash(self.to_def_id()).local_hash().hash_stable(hcx, hasher);
415416
}
416417
}
417418

418419
impl<CTX: HashStableContext> HashStable<CTX> for CrateNum {
419420
#[inline]
420421
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
421-
self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
422+
self.as_def_id().to_stable_hash_key(hcx).stable_crate_id().hash_stable(hcx, hasher);
422423
}
423424
}
424425

0 commit comments

Comments
 (0)