Skip to content

Commit 41ce641

Browse files
committed
Auto merge of #92130 - Kobzol:stable-hash-str, r=cjgillot
Use hash_stable for hashing str This seemed like an oversight. With this change the hash can go through the `HashStable` machinery directly.
2 parents 4ee34f3 + c695b60 commit 41ce641

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_data_structures/src/stable_hasher.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,8 @@ impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for ::std::sync::Arc<T> {
379379

380380
impl<CTX> HashStable<CTX> for str {
381381
#[inline]
382-
fn hash_stable(&self, _: &mut CTX, hasher: &mut StableHasher) {
383-
self.len().hash(hasher);
384-
self.as_bytes().hash(hasher);
382+
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
383+
self.as_bytes().hash_stable(ctx, hasher);
385384
}
386385
}
387386

0 commit comments

Comments
 (0)