Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {

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

let delayed_resolver = Steal::new((resolver, krate));
mid_hir::Crate::new(owners, delayed_ids, delayed_resolver, opt_hir_hash)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Linker {
Linker {
dep_graph: tcx.dep_graph.clone(),
output_filenames: Arc::clone(tcx.output_filenames(())),
crate_hash: if tcx.needs_crate_hash() {
crate_hash: if tcx.sess.opts.incremental.is_some() {
Some(tcx.crate_hash(LOCAL_CRATE))
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<'tcx> TyCtxt<'tcx> {
attrs: &SortedMap<ItemLocalId, &[Attribute]>,
define_opaque: Option<&[(Span, LocalDefId)]>,
) -> Hashes {
if !self.needs_crate_hash() {
if !self.needs_hir_hash() {
return Hashes { opt_hash_including_bodies: None, attrs_hash: None };
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,12 @@ impl<'tcx> TyCtxt<'tcx> {
})
}

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