diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index f800ec6a6a1..b8ad66901c6 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -559,7 +559,8 @@ pub fn hash_stable_hashmap( SK: HashStable + Ord, F: Fn(&K, &HCX) -> SK, { - let mut entries: Vec<_> = map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect(); + let mut entries: SmallVec<[_; 3]> = + map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect(); entries.sort_unstable_by(|&(ref sk1, _), &(ref sk2, _)| sk1.cmp(sk2)); entries.hash_stable(hcx, hasher); }