Skip to content

Commit e4b4d18

Browse files
committed
Use SmallVec in Hash map stable hashing
1 parent 91b9319 commit e4b4d18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: compiler/rustc_data_structures/src/stable_hasher.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
552552
SK: HashStable<HCX> + Ord,
553553
F: Fn(&K, &HCX) -> SK,
554554
{
555-
let mut entries: Vec<_> = map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect();
555+
let mut entries: SmallVec<[_; 3]> =
556+
map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect();
556557
entries.sort_unstable_by(|&(ref sk1, _), &(ref sk2, _)| sk1.cmp(sk2));
557558
entries.hash_stable(hcx, hasher);
558559
}

0 commit comments

Comments
 (0)