Skip to content

Commit 5313fb1

Browse files
committed
rename needs_crate_hash to needs_hir_hash.
It's easy to confuse the functionality of `needs_crate_hash` with "is the crate_hash query needed" right now. The function returns whether we need to calculate the stable hash of various hir structs.
1 parent a34cb76 commit 5313fb1

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {
563563

564564
// Don't hash unless necessary, because it's expensive.
565565
let opt_hir_hash =
566-
if tcx.needs_crate_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None };
566+
if tcx.needs_hir_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None };
567567

568568
let delayed_resolver = Steal::new((resolver, krate));
569569
mid_hir::Crate::new(owners, delayed_ids, delayed_resolver, opt_hir_hash)

compiler/rustc_middle/src/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'tcx> TyCtxt<'tcx> {
237237
attrs: &SortedMap<ItemLocalId, &[Attribute]>,
238238
define_opaque: Option<&[(Span, LocalDefId)]>,
239239
) -> Hashes {
240-
if !self.needs_crate_hash() {
240+
if !self.needs_hir_hash() {
241241
return Hashes { opt_hash_including_bodies: None, attrs_hash: None };
242242
}
243243

compiler/rustc_middle/src/ty/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,12 +1136,12 @@ impl<'tcx> TyCtxt<'tcx> {
11361136
})
11371137
}
11381138

1139-
pub fn needs_crate_hash(self) -> bool {
1140-
// Why is the crate hash needed for these configurations?
1139+
pub fn needs_hir_hash(self) -> bool {
1140+
// Why is the hir hash needed for these configurations?
11411141
// - debug_assertions: for the "fingerprint the result" check in
11421142
// `rustc_query_impl::execution::execute_job`.
11431143
// - incremental: for query lookups.
1144-
// - needs_metadata: for putting into crate metadata.
1144+
// - needs_metadata: it is included in the crate metadata through the crate_hash query
11451145
// - instrument_coverage: for putting into coverage data (see
11461146
// `hash_mir_source`).
11471147
// - metrics_dir: metrics use the strict version hash in the filenames

0 commit comments

Comments
 (0)