diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 6d75b0fb8a0ca..2bbcab57d08f4 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -506,14 +506,6 @@ unsafe impl StableOrd for String { const CAN_USE_UNSTABLE_SORT: bool = true; } -impl ToStableHashKey for String { - type KeyType = String; - #[inline] - fn to_stable_hash_key(&self, _: &HCX) -> Self::KeyType { - self.clone() - } -} - impl, T2: ToStableHashKey> ToStableHashKey for (T1, T2) { type KeyType = (T1::KeyType, T2::KeyType); #[inline] @@ -647,14 +639,13 @@ impl_stable_traits_for_trivial_type!(::std::path::PathBuf); impl HashStable for ::std::collections::HashMap where - K: ToStableHashKey + Eq, + K: HashStable + Eq, V: HashStable, R: BuildHasher, { #[inline] fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) { stable_hash_reduce(hcx, hasher, self.iter(), self.len(), |hasher, hcx, (key, value)| { - let key = key.to_stable_hash_key(hcx); key.hash_stable(hcx, hasher); value.hash_stable(hcx, hasher); }); diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 0b44071496ea8..7fe72f8a622c5 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -4,7 +4,7 @@ use rustc_arena::DroplessArena; use rustc_data_structures::fx::FxIndexSet; -use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lock; use rustc_macros::HashStable_Generic; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; @@ -2095,14 +2095,6 @@ impl HashStable for Symbol { } } -impl ToStableHashKey for Symbol { - type KeyType = String; - #[inline] - fn to_stable_hash_key(&self, _: &CTX) -> String { - self.as_str().to_string() - } -} - pub(crate) struct Interner(Lock); // The `&'static str`s in this type actually point into the arena.