about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-02-25 17:51:28 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-02-25 17:51:28 +0000
commit5875d7b03c4dba91be95cacd3f02bdb7ccc90a0e (patch)
tree5580f523d857e6093882e183dfc0af0565c7067d
parent8b0440a66942ac1f14707ae25a1efbbe7f24a686 (diff)
downloadrust-5875d7b03c4dba91be95cacd3f02bdb7ccc90a0e.tar.gz
rust-5875d7b03c4dba91be95cacd3f02bdb7ccc90a0e.zip
"Reset" the hashing context before stable hashing the types
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 8f067de3665..34d18281c59 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -31,7 +31,7 @@ use rustc_ast as ast;
 use rustc_attr as attr;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
 use rustc_data_structures::intern::Interned;
-use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
+use rustc_data_structures::stable_hasher::{HashStable, NodeIdHashingMode, StableHasher};
 use rustc_data_structures::tagged_ptr::CopyTaggedPtr;
 use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
@@ -471,7 +471,11 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Ty<'tcx> {
 
             let stable_hash: Fingerprint = {
                 let mut hasher = StableHasher::new();
-                kind.hash_stable(hcx, &mut hasher);
+                hcx.while_hashing_spans(false, |hcx| {
+                    hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
+                        kind.hash_stable(hcx, &mut hasher)
+                    })
+                });
                 hasher.finish()
             };
             stable_hash.hash_stable(hcx, hasher);