View all comments
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
View all comments
The
crate_hashquery 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:
StableHasherand aStableHashingContextinrustc_metadata::rmeta::encoder::EncodeContext;opaqueencoder by a call tohash_stablewith the same data;CrateNum,DefId,LocalDefId...);crate_hashquery inrustc_middle::hir::map, and reimplement it from the just-encoded metadata;Please reach out on zulip if more details are required.
cc @michaelwoerister