Skip to content

Commit 6ca3c44

Browse files
Add back str sentinels
1 parent b24c62d commit 6ca3c44

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rustc-hash/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@ impl Hasher for FxHasher {
165165
self.add_to_hash(i);
166166
}
167167

168-
// Avoid hashing 0xFF sentinel; we don't need prefix-free hashes.
169168
#[inline]
170169
fn write_str(&mut self, s: &str) {
171170
self.write(s.as_bytes());
171+
// FIXME: Not having this seems to add significant cost to Symbol::intern(?), but it's not
172+
// very clear why. That's interning &str, so it's not obvious why this matters.
173+
self.write_u8(0xFF);
172174
}
173175

174176
// Avoid hashing length prefixes. For our purposes the actual data gives us plenty of entropy

0 commit comments

Comments
 (0)