]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_data_structures/stable_hasher.rs
Rollup merge of #66325 - BartMassey:master, r=joshtriplett
[rust.git] / src / librustc_data_structures / stable_hasher.rs
index 092208cfe1db74d6c3ff2ed525d6f31f3042ced1..70492d499222fe89f547ede56f948f4dfd012369 100644 (file)
@@ -149,7 +149,7 @@ fn write_isize(&mut self, i: isize) {
 ///
 ///   That second condition is usually not required for hash functions
 ///   (e.g. `Hash`). In practice this means that `hash_stable` must feed any
-///   information into the hasher that a `PartialEq` comparision takes into
+///   information into the hasher that a `PartialEq` comparison takes into
 ///   account. See [#49300](https://github.com/rust-lang/rust/issues/49300)
 ///   for an example where violating this invariant has caused trouble in the
 ///   past.
@@ -429,6 +429,16 @@ fn hash_stable(&self, _: &mut CTX, hasher: &mut StableHasher) {
     }
 }
 
+impl<T, CTX> HashStable<CTX> for ::std::ops::RangeInclusive<T>
+    where T: HashStable<CTX>
+{
+    #[inline]
+    fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
+        self.start().hash_stable(ctx, hasher);
+        self.end().hash_stable(ctx, hasher);
+    }
+}
+
 impl<I: vec::Idx, T, CTX> HashStable<CTX> for vec::IndexVec<I, T>
     where T: HashStable<CTX>,
 {