about summary refs log tree commit diff
path: root/src/libcore/array.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-20 23:03:09 +0000
committerbors <bors@rust-lang.org>2015-01-20 23:03:09 +0000
commit29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba (patch)
tree98824cc18b1c65ff09f383438d79ad2d0a0e2ea8 /src/libcore/array.rs
parent583c5c589ed02e5b6b14a576e35e0ce68988d949 (diff)
parent631896dc1996d239a532b0ce02d5fe886660149e (diff)
downloadrust-29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba.tar.gz
rust-29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba.zip
Auto merge of #21439 - alexcrichton:rollup, r=alexcrichton
Continuation of https://github.com/rust-lang/rust/pull/21428
Diffstat (limited to 'src/libcore/array.rs')
-rw-r--r--src/libcore/array.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index c07fac108d6..0cc31bf70de 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -17,6 +17,7 @@
 use clone::Clone;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use fmt;
+use hash::{Hash, Hasher, self};
 use marker::Copy;
 use ops::{Deref, FullRange};
 use option::Option;
@@ -32,6 +33,12 @@ macro_rules! array_impls {
                 }
             }
 
+            impl<S: hash::Writer + Hasher, T: Hash<S>> Hash<S> for [T; $N] {
+                fn hash(&self, state: &mut S) {
+                    Hash::hash(&self[], state)
+                }
+            }
+
             #[unstable = "waiting for Show to stabilize"]
             impl<T:fmt::Show> fmt::Show for [T; $N] {
                 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {