about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-28 01:04:33 +0000
committerbors <bors@rust-lang.org>2021-12-28 01:04:33 +0000
commit41ce641a407965ca0709f9f2d60faae3a56755c2 (patch)
tree63a6dd4e2c6ceba4c6c31721c950ae5b7420b4f3 /compiler/rustc_data_structures
parent4ee34f355101db4d7a97455589c9dbc335d7a963 (diff)
parentc695b6026ca181ab41f8ab81848df0956058afae (diff)
downloadrust-41ce641a407965ca0709f9f2d60faae3a56755c2.tar.gz
rust-41ce641a407965ca0709f9f2d60faae3a56755c2.zip
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.
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/stable_hasher.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs
index d87aa5ed0d5..3da35178957 100644
--- a/compiler/rustc_data_structures/src/stable_hasher.rs
+++ b/compiler/rustc_data_structures/src/stable_hasher.rs
@@ -379,9 +379,8 @@ impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for ::std::sync::Arc<T> {
 
 impl<CTX> HashStable<CTX> for str {
     #[inline]
-    fn hash_stable(&self, _: &mut CTX, hasher: &mut StableHasher) {
-        self.len().hash(hasher);
-        self.as_bytes().hash(hasher);
+    fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
+        self.as_bytes().hash_stable(ctx, hasher);
     }
 }