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/libcore/array.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libcore/array.rs') diff --git a/src/libcore/array.rs b/src/libcore/array.rs index e85a132ed36..88e23377046 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -39,7 +39,7 @@ macro_rules! array_impls { } } - #[unstable = "waiting for PartialEq to stabilize"] + #[stable] impl PartialEq<[B, ..$N]> for [A, ..$N] where A: PartialEq { #[inline] fn eq(&self, other: &[B, ..$N]) -> bool { @@ -51,6 +51,7 @@ macro_rules! array_impls { } } + #[stable] impl<'a, A, B, Rhs> PartialEq for [A, ..$N] where A: PartialEq, Rhs: Deref<[B]>, @@ -61,6 +62,7 @@ macro_rules! array_impls { fn ne(&self, other: &Rhs) -> bool { PartialEq::ne(self[], &**other) } } + #[stable] impl<'a, A, B, Lhs> PartialEq<[B, ..$N]> for Lhs where A: PartialEq, Lhs: Deref<[A]> @@ -71,10 +73,10 @@ macro_rules! array_impls { fn ne(&self, other: &[B, ..$N]) -> bool { PartialEq::ne(&**self, other[]) } } - #[unstable = "waiting for Eq to stabilize"] + #[stable] impl Eq for [T, ..$N] { } - #[unstable = "waiting for PartialOrd to stabilize"] + #[stable] impl PartialOrd for [T, ..$N] { #[inline] fn partial_cmp(&self, other: &[T, ..$N]) -> Option { @@ -98,7 +100,7 @@ macro_rules! array_impls { } } - #[unstable = "waiting for Ord to stabilize"] + #[stable] impl Ord for [T, ..$N] { #[inline] fn cmp(&self, other: &[T, ..$N]) -> Ordering { -- cgit 1.4.1-3-g733a5