about summary refs log tree commit diff
path: root/src/libstd/old_path
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-18 14:32:03 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-18 14:32:03 -0800
commit9774b7e64b7ff8323b4f8160cc38eb793f447217 (patch)
tree5583e7a616f23fc144f56f10f65c51ab96d93001 /src/libstd/old_path
parent261364d45d6a90dbe1e6702455f7a6ea661e74c9 (diff)
parentf83e23ad7c464c242c2d7ace7212d323980b2bca (diff)
downloadrust-9774b7e64b7ff8323b4f8160cc38eb793f447217.tar.gz
rust-9774b7e64b7ff8323b4f8160cc38eb793f447217.zip
rollup merge of #22480: alexcrichton/hashv3
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/libstd/old_path')
-rw-r--r--src/libstd/old_path/posix.rs9
-rw-r--r--src/libstd/old_path/windows.rs16
2 files changed, 25 insertions, 0 deletions
diff --git a/src/libstd/old_path/posix.rs b/src/libstd/old_path/posix.rs
index 35bffa689f3..b0fec102103 100644
--- a/src/libstd/old_path/posix.rs
+++ b/src/libstd/old_path/posix.rs
@@ -100,12 +100,21 @@ impl FromStr for Path {
 #[derive(Debug, Clone, PartialEq, Copy)]
 pub struct ParsePathError;
 
+#[cfg(stage0)]
 impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Path {
     #[inline]
     fn hash(&self, state: &mut S) {
         self.repr.hash(state)
     }
 }
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+impl hash::Hash for Path {
+    #[inline]
+    fn hash<H: hash::Hasher>(&self, state: &mut H) {
+        self.repr.hash(state)
+    }
+}
 
 impl BytesContainer for Path {
     #[inline]
diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs
index c9d6eeda762..4754efbd1fe 100644
--- a/src/libstd/old_path/windows.rs
+++ b/src/libstd/old_path/windows.rs
@@ -127,6 +127,7 @@ impl FromStr for Path {
 #[derive(Debug, Clone, PartialEq, Copy)]
 pub struct ParsePathError;
 
+#[cfg(stage0)]
 impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Path {
     #[cfg(not(test))]
     #[inline]
@@ -140,6 +141,21 @@ impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Path {
         // No-op because the `hash` implementation will be wrong.
     }
 }
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+impl hash::Hash for Path {
+    #[cfg(not(test))]
+    #[inline]
+    fn hash<H: hash::Hasher>(&self, state: &mut H) {
+        self.repr.hash(state)
+    }
+
+    #[cfg(test)]
+    #[inline]
+    fn hash<H: hash::Hasher>(&self, _: &mut H) {
+        // No-op because the `hash` implementation will be wrong.
+    }
+}
 
 impl BytesContainer for Path {
     #[inline]