From b94bcbf56eab163517e8ffc93888284b8dbb6238 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Tue, 30 Dec 2014 14:44:26 -0800 Subject: 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] --- src/libstd/collections/hash/map.rs | 2 ++ src/libstd/collections/hash/set.rs | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/libstd') 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, V: Clone, S, H: Hasher> HashMap { } } +#[stable] impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap { fn eq(&self, other: &HashMap) -> bool { if self.len() != other.len() { return false; } @@ -1271,6 +1272,7 @@ impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap, V: Eq, S, H: Hasher> Eq for HashMap {} impl + Show, V: Show, S, H: Hasher> Show for HashMap { 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, S, H: Hasher> HashSet { } } +#[stable] impl, S, H: Hasher> PartialEq for HashSet { fn eq(&self, other: &HashSet) -> bool { if self.len() != other.len() { return false; } @@ -580,6 +581,7 @@ impl, S, H: Hasher> PartialEq for HashSet { } } +#[stable] impl, S, H: Hasher> Eq for HashSet {} impl + fmt::Show, S, H: Hasher> fmt::Show for HashSet { -- cgit 1.4.1-3-g733a5