Skip to content

Commit 31ee872

Browse files
committed
Auto merge of #78415 - tgnottingham:expn_id_tag_hash, r=Aaron1011
rustc_span: avoid hashing ExpnId tag when using cached hash
2 parents 3dddf6a + a3623e0 commit 31ee872

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/rustc_span/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1925,9 +1925,7 @@ impl<CTX: HashStableContext> HashStable<CTX> for ExpnId {
19251925
return;
19261926
}
19271927

1928-
TAG_NOT_ROOT.hash_stable(ctx, hasher);
19291928
let index = self.as_u32() as usize;
1930-
19311929
let res = CACHE.with(|cache| cache.borrow().get(index).copied().flatten());
19321930

19331931
if let Some(res) = res {
@@ -1936,6 +1934,7 @@ impl<CTX: HashStableContext> HashStable<CTX> for ExpnId {
19361934
let new_len = index + 1;
19371935

19381936
let mut sub_hasher = StableHasher::new();
1937+
TAG_NOT_ROOT.hash_stable(ctx, &mut sub_hasher);
19391938
self.expn_data().hash_stable(ctx, &mut sub_hasher);
19401939
let sub_hash: Fingerprint = sub_hasher.finish();
19411940

0 commit comments

Comments
 (0)