]> git.lizzy.rs Git - rust.git/commitdiff
Hash the length of the RingBuf before hashing elements
authornham <hamann.nick@gmail.com>
Sun, 27 Jul 2014 16:37:32 +0000 (12:37 -0400)
committernham <hamann.nick@gmail.com>
Sun, 27 Jul 2014 16:37:32 +0000 (12:37 -0400)
src/libcollections/ringbuf.rs

index 6b1670fbe855eeabce7a87486d257ee372ea005e..44b546f665688a069ca478a4f1198cf06ab643b7 100644 (file)
@@ -460,6 +460,7 @@ fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> {
 
 impl<S: Writer, A: Hash<S>> Hash<S> for RingBuf<A> {
     fn hash(&self, state: &mut S) {
+        self.len().hash(state);
         for elt in self.iter() {
             elt.hash(state);
         }