about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-09-20 17:40:34 -0700
committerTyson Nottingham <tgnottingham@gmail.com>2020-10-26 13:43:48 -0700
commita3623e05429952cd8cbfd875409d3cb7c8f8045d (patch)
treeaa19065491e4194aeca6d9683f09625ca9276a85
parent0dce3f606e05cffab7361c132a399d3550ab0df8 (diff)
downloadrust-a3623e05429952cd8cbfd875409d3cb7c8f8045d.tar.gz
rust-a3623e05429952cd8cbfd875409d3cb7c8f8045d.zip
rustc_span: avoid hashing ExpnId tag when using cached hash
-rw-r--r--compiler/rustc_span/src/lib.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index d036c078049..746b516a1b6 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -1925,9 +1925,7 @@ impl<CTX: HashStableContext> HashStable<CTX> for ExpnId {
             return;
         }
 
-        TAG_NOT_ROOT.hash_stable(ctx, hasher);
         let index = self.as_u32() as usize;
-
         let res = CACHE.with(|cache| cache.borrow().get(index).copied().flatten());
 
         if let Some(res) = res {
@@ -1936,6 +1934,7 @@ impl<CTX: HashStableContext> HashStable<CTX> for ExpnId {
             let new_len = index + 1;
 
             let mut sub_hasher = StableHasher::new();
+            TAG_NOT_ROOT.hash_stable(ctx, &mut sub_hasher);
             self.expn_data().hash_stable(ctx, &mut sub_hasher);
             let sub_hash: Fingerprint = sub_hasher.finish();