diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2021-10-25 08:26:00 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2021-10-25 08:26:00 +0200 |
| commit | e4b4d18f589b2d0cfcf244124ab43da34a3d8794 (patch) | |
| tree | 457dffc540c32811aa5c86e7feab85c74d0387b6 | |
| parent | 91b931926fd49fc97d1e39f2b8206abf1d77ce7d (diff) | |
| download | rust-e4b4d18f589b2d0cfcf244124ab43da34a3d8794.tar.gz rust-e4b4d18f589b2d0cfcf244124ab43da34a3d8794.zip | |
Use SmallVec in Hash map stable hashing
| -rw-r--r-- | compiler/rustc_data_structures/src/stable_hasher.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 354f9dd93cc..b3958af7a4d 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<HCX, K, V, R, SK, F>( SK: HashStable<HCX> + 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); } |
