Skip to content

Investigate computing crate_hash by hashing metadata #94878

@cjgillot

Description

@cjgillot

The crate_hash query is used to detect is metadata has changed before attempting to decode more complex information from it.
Until now, this crate hash has been computed manually using HIR.
Computing it while encoding metadata itself may be more robust and exhaustive.

General instructions:

  • add a StableHasher and a StableHashingContext in rustc_metadata::rmeta::encoder::EncodeContext;
  • double all accesses to the embedded opaque encoder by a call to hash_stable with the same data;
  • manually reimplement encoding and hashing for special datatypes (CrateNum, DefId, LocalDefId...);
  • remove the implementation of the crate_hash query in rustc_middle::hir::map, and reimplement it from the just-encoded metadata;
  • evaluate effect on performance.

Please reach out on zulip if more details are required.
cc @michaelwoerister

Metadata

Metadata

Labels

E-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions