- Implement HashStable by just calling
Hash::hash(). Also implement
StableOrdfor the type since that has the same requirements.
- Controls what data we do or do not hash. Whenever a
HashStableimplementation caches its result, it needs to include
HashingControlsas part of the key, to ensure that it does not produce an incorrect result (for example, using a
Fingerprintproduced while hashing
Spans when a
Spans is being requested)
- When hashing something that ends up affecting properties like symbol names, we want these symbol names to be calculated independently of other factors like what architecture you’re compiling from.
- Something that implements
HashStable<CTX>can be hashed in a way that is stable across multiple compilation sessions.
- Trait for marking a type as having a sort order that is stable across compilation session boundaries. More formally:
- Implement this for types that can be turned into stable keys like, for example, for DefId that can be converted to a DefPathHash. This is used for bringing maps into a predictable order before hashing them.