Add StableOrd trait as proposed in MCP 533.

The StableOrd trait can be used to mark types as having a stable
sort order across compilation sessions. Collections that sort their
items in a stable way can safely implement HashStable by
hashing items in sort order.
This commit is contained in:
Michael Woerister
2022-12-02 15:14:49 +01:00
parent 11663b1b48
commit 3a58309798
7 changed files with 96 additions and 36 deletions

View File

@@ -140,7 +140,7 @@ impl stable_hasher::StableHasherResult for Fingerprint {
}
}
impl_stable_hash_via_hash!(Fingerprint);
impl_stable_ord_and_stable_hash_via_hash!(Fingerprint);
impl<E: Encoder> Encodable<E> for Fingerprint {
#[inline]