Skip to content

Commit e219c53

Browse files
committed
Remove usage of to_stable_hash_key when stable hashing hash maps
1 parent f4d794e commit e219c53

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

compiler/rustc_data_structures/src/stable_hasher.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,6 @@ unsafe impl StableOrd for String {
506506
const CAN_USE_UNSTABLE_SORT: bool = true;
507507
}
508508

509-
impl<HCX> ToStableHashKey<HCX> for String {
510-
type KeyType = String;
511-
#[inline]
512-
fn to_stable_hash_key(&self, _: &HCX) -> Self::KeyType {
513-
self.clone()
514-
}
515-
}
516-
517509
impl<HCX, T1: ToStableHashKey<HCX>, T2: ToStableHashKey<HCX>> ToStableHashKey<HCX> for (T1, T2) {
518510
type KeyType = (T1::KeyType, T2::KeyType);
519511
#[inline]
@@ -647,14 +639,13 @@ impl_stable_traits_for_trivial_type!(::std::path::PathBuf);
647639

648640
impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R>
649641
where
650-
K: ToStableHashKey<HCX> + Eq,
642+
K: HashStable<HCX> + Eq,
651643
V: HashStable<HCX>,
652644
R: BuildHasher,
653645
{
654646
#[inline]
655647
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
656648
stable_hash_reduce(hcx, hasher, self.iter(), self.len(), |hasher, hcx, (key, value)| {
657-
let key = key.to_stable_hash_key(hcx);
658649
key.hash_stable(hcx, hasher);
659650
value.hash_stable(hcx, hasher);
660651
});

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use rustc_arena::DroplessArena;
66
use rustc_data_structures::fx::FxIndexSet;
7-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
7+
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
88
use rustc_data_structures::sync::Lock;
99
use rustc_macros::HashStable_Generic;
1010
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
@@ -2095,14 +2095,6 @@ impl<CTX> HashStable<CTX> for Symbol {
20952095
}
20962096
}
20972097

2098-
impl<CTX> ToStableHashKey<CTX> for Symbol {
2099-
type KeyType = String;
2100-
#[inline]
2101-
fn to_stable_hash_key(&self, _: &CTX) -> String {
2102-
self.as_str().to_string()
2103-
}
2104-
}
2105-
21062098
pub(crate) struct Interner(Lock<InternerInner>);
21072099

21082100
// The `&'static str`s in this type actually point into the arena.

0 commit comments

Comments
 (0)