summary refs log tree commit diff
path: root/src/libcore/array.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-17 20:48:07 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-18 08:26:20 -0800
commitf83e23ad7c464c242c2d7ace7212d323980b2bca (patch)
tree4af495be32288f7af75d660173a19e412c9a29d8 /src/libcore/array.rs
parentdfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (diff)
downloadrust-f83e23ad7c464c242c2d7ace7212d323980b2bca.tar.gz
rust-f83e23ad7c464c242c2d7ace7212d323980b2bca.zip
std: Stabilize the `hash` module
This commit is an implementation of [RFC 823][rfc] which is another pass over
the `std::hash` module for stabilization. The contents of the module were not
entirely marked stable, but some portions which remained quite similar to the
previous incarnation are now marked `#[stable]`. Specifically:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0823-hash-simplification.md

* `std::hash` is now stable (the name)
* `Hash` is now stable
* `Hash::hash` is now stable
* `Hasher` is now stable
* `SipHasher` is now stable
* `SipHasher::new` and `new_with_keys` are now stable
* `Hasher for SipHasher` is now stable
* Many `Hash` implementations are now stable

All other portions of the `hash` module remain `#[unstable]` as they are less
commonly used and were recently redesigned.

This commit is a breaking change due to the modifications to the `std::hash` API
and more details can be found on the [RFC][rfc].

Closes #22467
[breaking-change]
Diffstat (limited to 'src/libcore/array.rs')
-rw-r--r--src/libcore/array.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index 838ca4e478b..b2bb5ee7999 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -17,7 +17,7 @@
 use clone::Clone;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use fmt;
-use hash::{Hash, Hasher, self};
+use hash::{Hash, self};
 use iter::IntoIterator;
 use marker::Copy;
 use ops::Deref;
@@ -35,11 +35,19 @@ macro_rules! array_impls {
                 }
             }
 
-            impl<S: hash::Writer + Hasher, T: Hash<S>> Hash<S> for [T; $N] {
+            #[cfg(stage0)]
+            impl<S: hash::Writer + hash::Hasher, T: Hash<S>> Hash<S> for [T; $N] {
                 fn hash(&self, state: &mut S) {
                     Hash::hash(&self[], state)
                 }
             }
+            #[cfg(not(stage0))]
+            #[stable(feature = "rust1", since = "1.0.0")]
+            impl<T: Hash> Hash for [T; $N] {
+                fn hash<H: hash::Hasher>(&self, state: &mut H) {
+                    Hash::hash(&self[], state)
+                }
+            }
 
             #[stable(feature = "rust1", since = "1.0.0")]
             impl<T: fmt::Debug> fmt::Debug for [T; $N] {