Skip to content

Commit 47eb6ee

Browse files
authored
Fix cache key collisions for paths with separators (#12159)
Closes #12158 Hashing `Path` does not take into account path separators so `foo/bar` is the same as `foobar` which is no good for our case. I'm guessing this is an upstream bug, perhaps introduced by rust-lang/rust@45082b0? I'm investigating that further.
1 parent b4f7d5b commit 47eb6ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/ruff_cache/src/cache_key.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ impl<K: CacheKey + Ord, V: CacheKey> CacheKey for BTreeMap<K, V> {
350350
impl CacheKey for Path {
351351
#[inline]
352352
fn cache_key(&self, state: &mut CacheKeyHasher) {
353-
self.hash(&mut *state);
353+
for component in self.components() {
354+
component.hash(&mut *state);
355+
}
354356
}
355357
}
356358

0 commit comments

Comments
 (0)