From e4b4d18f589b2d0cfcf244124ab43da34a3d8794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 25 Oct 2021 08:26:00 +0200 Subject: [PATCH] Use SmallVec in Hash map stable hashing --- compiler/rustc_data_structures/src/stable_hasher.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 354f9dd93cc4d..b3958af7a4d50 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -552,7 +552,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); }