Skip to main content

should_verify_loaded_value

Function should_verify_loaded_value 

Source
pub(crate) fn should_verify_loaded_value(
    tcx: TyCtxt<'_>,
    dep_graph_data: &DepGraphData,
    key_fingerprint: PackedFingerprint,
) -> bool
Expand description

Whether a value loaded from the on-disk cache should have its fingerprint verified with incremental_verify_ich. If -Zincremental-verify-ich is specified, re-hash results from the cache and make sure that they have the expected fingerprint.

If not, we still verify a subset: re-hashing is too expensive to do for every value. The subset rotates with the session count, covering the whole cache every 32 sessions, and is deterministic so that a verification failure reproduces on retry.

to_smaller_hash mixes both fingerprint halves because neither half is evenly distributed on its own (DefPathHash keys share the StableCrateId, HirId keys contain a sequential id).