diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2021-12-12 22:54:09 +0100 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2021-12-12 23:48:11 +0100 |
| commit | 6e33d3ecc26f294c275b55fe02a33645e252f81a (patch) | |
| tree | 865352f2b3a622f8d7fe4599cdac72e33b10a5ab /compiler/rustc_data_structures/src | |
| parent | a5f5f6b6892ffe5364e25345c6f5a0113ae33a98 (diff) | |
| download | rust-6e33d3ecc26f294c275b55fe02a33645e252f81a.tar.gz rust-6e33d3ecc26f294c275b55fe02a33645e252f81a.zip | |
Use modular arithmetic
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/stable_hasher.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index c2218b92a44..150c835c236 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -503,7 +503,7 @@ impl_stable_hash_via_hash!(::std::path::PathBuf); impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R> where - K: ToStableHashKey<HCX> + Eq, + K: HashStable<HCX> + ToStableHashKey<HCX> + Eq, V: HashStable<HCX>, R: BuildHasher, { @@ -555,7 +555,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>( map: &::std::collections::HashMap<K, V, R>, to_stable_hash_key: F, ) where - K: Eq, + K: Eq + HashStable<HCX>, V: HashStable<HCX>, R: BuildHasher, SK: HashStable<HCX> + Ord, @@ -570,7 +570,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>( value.hash_stable(hcx, &mut hasher); hasher.finish::<u128>() }) - .reduce(|accum, value| accum.wrapping_mul(value)); + .reduce(|accum, value| accum.wrapping_add(value)); map.len().hash_stable(hcx, hasher); hash.hash_stable(hcx, hasher); } |
