1
Fork 0

Use the interned stable hash as plain hash.

This commit is contained in:
Camille GILLOT 2022-11-11 12:18:49 +00:00
parent d47424b833
commit 9d86e6abaf
2 changed files with 6 additions and 4 deletions

View file

@ -156,7 +156,11 @@ impl<T> Deref for WithStableHash<T> {
impl<T: Hash> Hash for WithStableHash<T> { impl<T: Hash> Hash for WithStableHash<T> {
#[inline] #[inline]
fn hash<H: Hasher>(&self, s: &mut H) { fn hash<H: Hasher>(&self, s: &mut H) {
self.internee.hash(s) if self.stable_hash != Fingerprint::ZERO {
self.stable_hash.hash(s)
} else {
self.internee.hash(s)
}
} }
} }

View file

@ -192,9 +192,7 @@ impl<'tcx> CtxtInterners<'tcx> {
// It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them. // It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them.
// Without incremental, we rarely stable-hash types, so let's not do it proactively. // Without incremental, we rarely stable-hash types, so let's not do it proactively.
let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER) let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER) {
|| sess.opts.incremental.is_none()
{
Fingerprint::ZERO Fingerprint::ZERO
} else { } else {
let mut hasher = StableHasher::new(); let mut hasher = StableHasher::new();