Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e413ff3

Browse files
committedMar 21, 2025
Auto merge of #138772 - oli-obk:no_hash_hir_crate, r=<try>
Avoid hashing the hir_crate query related reading: #94852 Basically I want to move the crate hashing to the `crate_hash` query and make it work off `hir_crate_items` instead of `hir_crate`. So this is a step towards that, if perf allows it. r? `@ghost`
2 parents 5d85a71 + a8affdf commit e413ff3

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed
 

‎compiler/rustc_hir/src/stable_hash_impls.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_span::def_id::DefPathHash;
33

44
use crate::HashIgnoredAttrId;
55
use crate::hir::{
6-
AttributeMap, BodyId, Crate, ForeignItemId, ImplItemId, ItemId, OwnerNodes, TraitItemId,
6+
AttributeMap, BodyId, ForeignItemId, ImplItemId, ItemId, OwnerNodes, TraitItemId,
77
};
88
use crate::hir_id::{HirId, ItemLocalId};
99

@@ -111,13 +111,6 @@ impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap
111111
}
112112
}
113113

114-
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Crate<'_> {
115-
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
116-
let Crate { owners: _, opt_hir_hash } = self;
117-
opt_hir_hash.unwrap().hash_stable(hcx, hasher)
118-
}
119-
}
120-
121114
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for HashIgnoredAttrId {
122115
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
123116
hcx.hash_attr_id(self, hasher)

‎compiler/rustc_middle/src/query/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ rustc_queries! {
151151
query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
152152
arena_cache
153153
eval_always
154+
no_hash
154155
desc { "getting the crate HIR" }
155156
}
156157

0 commit comments

Comments
 (0)
Failed to load comments.