diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2022-12-05 10:45:31 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2022-12-05 10:45:31 +0100 |
| commit | 56aacb245ce484994ac2e0ecab72b477ad6dc362 (patch) | |
| tree | e44c1639dd889a9a75e97485455ab1bbbd9f5710 | |
| parent | 3a58309798e39ab48e4cb85c1013ad7e7410ace8 (diff) | |
| download | rust-56aacb245ce484994ac2e0ecab72b477ad6dc362.tar.gz rust-56aacb245ce484994ac2e0ecab72b477ad6dc362.zip | |
StableOrd: Address review comments.
| -rw-r--r-- | compiler/rustc_data_structures/src/fingerprint.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/stable_hasher.rs | 36 |
2 files changed, 19 insertions, 19 deletions
diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index 6f0b9bff90a..d98f4e43fe8 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -140,7 +140,7 @@ impl stable_hasher::StableHasherResult for Fingerprint { } } -impl_stable_ord_and_stable_hash_via_hash!(Fingerprint); +impl_stable_traits_for_trivial_type!(Fingerprint); impl<E: Encoder> Encodable<E> for Fingerprint { #[inline] diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index d43b74c2740..be70d30eeaf 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -255,7 +255,7 @@ pub unsafe trait StableOrd: Ord {} /// here in this module. /// /// Use `#[derive(HashStable_Generic)]` instead. -macro_rules! impl_stable_ord_and_stable_hash_via_hash { +macro_rules! impl_stable_traits_for_trivial_type { ($t:ty) => { impl<CTX> $crate::stable_hasher::HashStable<CTX> for $t { #[inline] @@ -268,23 +268,23 @@ macro_rules! impl_stable_ord_and_stable_hash_via_hash { }; } -impl_stable_ord_and_stable_hash_via_hash!(i8); -impl_stable_ord_and_stable_hash_via_hash!(i16); -impl_stable_ord_and_stable_hash_via_hash!(i32); -impl_stable_ord_and_stable_hash_via_hash!(i64); -impl_stable_ord_and_stable_hash_via_hash!(isize); +impl_stable_traits_for_trivial_type!(i8); +impl_stable_traits_for_trivial_type!(i16); +impl_stable_traits_for_trivial_type!(i32); +impl_stable_traits_for_trivial_type!(i64); +impl_stable_traits_for_trivial_type!(isize); -impl_stable_ord_and_stable_hash_via_hash!(u8); -impl_stable_ord_and_stable_hash_via_hash!(u16); -impl_stable_ord_and_stable_hash_via_hash!(u32); -impl_stable_ord_and_stable_hash_via_hash!(u64); -impl_stable_ord_and_stable_hash_via_hash!(usize); +impl_stable_traits_for_trivial_type!(u8); +impl_stable_traits_for_trivial_type!(u16); +impl_stable_traits_for_trivial_type!(u32); +impl_stable_traits_for_trivial_type!(u64); +impl_stable_traits_for_trivial_type!(usize); -impl_stable_ord_and_stable_hash_via_hash!(u128); -impl_stable_ord_and_stable_hash_via_hash!(i128); +impl_stable_traits_for_trivial_type!(u128); +impl_stable_traits_for_trivial_type!(i128); -impl_stable_ord_and_stable_hash_via_hash!(char); -impl_stable_ord_and_stable_hash_via_hash!(()); +impl_stable_traits_for_trivial_type!(char); +impl_stable_traits_for_trivial_type!(()); impl<CTX> HashStable<CTX> for ! { fn hash_stable(&self, _ctx: &mut CTX, _hasher: &mut StableHasher) { @@ -590,8 +590,8 @@ where } } -impl_stable_ord_and_stable_hash_via_hash!(::std::path::Path); -impl_stable_ord_and_stable_hash_via_hash!(::std::path::PathBuf); +impl_stable_traits_for_trivial_type!(::std::path::Path); +impl_stable_traits_for_trivial_type!(::std::path::PathBuf); impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R> where @@ -635,7 +635,7 @@ where } } -impl<K: StableOrd, HCX> HashStable<HCX> for ::std::collections::BTreeSet<K> +impl<K, HCX> HashStable<HCX> for ::std::collections::BTreeSet<K> where K: HashStable<HCX> + StableOrd, { |
