diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-12-30 14:44:26 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-12-30 14:44:26 -0800 |
| commit | b94bcbf56eab163517e8ffc93888284b8dbb6238 (patch) | |
| tree | 7a18c863cc94c86dd6ba2d9813af0d0af2b5b512 /src/libstd | |
| parent | 84f5ad8679c7fc454473ffbf389030f3e5fee379 (diff) | |
| download | rust-b94bcbf56eab163517e8ffc93888284b8dbb6238.tar.gz rust-b94bcbf56eab163517e8ffc93888284b8dbb6238.zip | |
Stabilize cmp
This patch marks `PartialEq`, `Eq`, `PartialOrd`, and `Ord` as `#[stable]`, as well as the majorify of manual implementaitons of these traits. The traits match the [reform RFC](https://github.com/rust-lang/rfcs/pull/439). Along the way, two changes are made: * The recently-added type parameters for `Ord` and `Eq` are removed. These were mistakenly added while adding them to `PartialOrd` and `PartialEq`, but they don't make sense given the laws that are required for (and use cases for) `Ord` and `Eq`. * More explicit laws are added for `PartialEq` and `PartialOrd`, connecting them to their associated mathematical concepts. In the future, many of the impls should be generalized; see since generalizing later is not a breaking change. [breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 2 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 7b7473b2c99..b473a665c76 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1261,6 +1261,7 @@ impl<K: Eq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> { } } +#[stable] impl<K: Eq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, H> { fn eq(&self, other: &HashMap<K, V, H>) -> bool { if self.len() != other.len() { return false; } @@ -1271,6 +1272,7 @@ impl<K: Eq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, } } +#[stable] impl<K: Eq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {} impl<K: Eq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> { diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 6d83d5510b3..93f6895f688 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -572,6 +572,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> { } } +#[stable] impl<T: Eq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> { fn eq(&self, other: &HashSet<T, H>) -> bool { if self.len() != other.len() { return false; } @@ -580,6 +581,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> { } } +#[stable] impl<T: Eq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {} impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> { |
