-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Location
https://doc.rust-lang.org/std/hash/trait.Hash.html#portability
Summary
Whether Hash and Hasher is portable between compiler versions is ambiguously documented, and potentially misleading.
Serialization formats intended to be portable between platforms or compiler versions should either avoid encoding hashes or only rely on Hash and Hasher implementations that provide additional guarantees.
Changes to the default behaviour of Hasher are frequently[1] discussed[2] without considering portability between rust versions. I am not aware of any breaking changes on stable rust yet, but implying that Hasher output can be stable between compiler versions seems misleading.
A rust-users discussion over whether rapidhash can offer a Hasher-compatible persistent hasher has generated conflicting opinions.
I think it would be restrictive to future work on the Hash trait to claim that Hash and Hasher are portable between compiler versions, and suggest that non-portability between compiler versions is made explicit in both the Hash and Hasher documentation.
Very happy to be convinced otherwise, as it would let me build a persistent RapidHasher if portability is indeed guaranteed. Thanks!