diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-11 12:18:49 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-11 13:02:37 +0000 |
| commit | 9d86e6abaf972bf3a31a8e5e3d948b7d5bf0d289 (patch) | |
| tree | 7138db5ed5d68b29c892aac0c0172c06d9cd3401 | |
| parent | d47424b8339e3c6f2e313ccc7bb08c6857d86e44 (diff) | |
| download | rust-9d86e6abaf972bf3a31a8e5e3d948b7d5bf0d289.tar.gz rust-9d86e6abaf972bf3a31a8e5e3d948b7d5bf0d289.zip | |
Use the interned stable hash as plain hash.
| -rw-r--r-- | compiler/rustc_data_structures/src/intern.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_data_structures/src/intern.rs b/compiler/rustc_data_structures/src/intern.rs index 8c94ce29b42..11cbff8ea6a 100644 --- a/compiler/rustc_data_structures/src/intern.rs +++ b/compiler/rustc_data_structures/src/intern.rs @@ -156,7 +156,11 @@ impl<T> Deref for WithStableHash<T> { impl<T: Hash> Hash for WithStableHash<T> { #[inline] 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) + } } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 8f96f5a9eb3..0ac712565b5 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -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. // Without incremental, we rarely stable-hash types, so let's not do it proactively. - let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER) - || sess.opts.incremental.is_none() - { + let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER) { Fingerprint::ZERO } else { let mut hasher = StableHasher::new(); |
