Skip to content

Commit 9d86e6a

Browse files
committed
Use the interned stable hash as plain hash.
1 parent d47424b commit 9d86e6a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

compiler/rustc_data_structures/src/intern.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ impl<T> Deref for WithStableHash<T> {
156156
impl<T: Hash> Hash for WithStableHash<T> {
157157
#[inline]
158158
fn hash<H: Hasher>(&self, s: &mut H) {
159-
self.internee.hash(s)
159+
if self.stable_hash != Fingerprint::ZERO {
160+
self.stable_hash.hash(s)
161+
} else {
162+
self.internee.hash(s)
163+
}
160164
}
161165
}
162166

compiler/rustc_middle/src/ty/context.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ impl<'tcx> CtxtInterners<'tcx> {
192192

193193
// It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them.
194194
// Without incremental, we rarely stable-hash types, so let's not do it proactively.
195-
let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER)
196-
|| sess.opts.incremental.is_none()
197-
{
195+
let stable_hash = if flags.flags.intersects(TypeFlags::NEEDS_INFER) {
198196
Fingerprint::ZERO
199197
} else {
200198
let mut hasher = StableHasher::new();

0 commit comments

Comments
 (0)