about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cmp.rs1
-rw-r--r--src/libcore/cmp_macros.rs13
-rw-r--r--src/libcore/iter.rs11
-rw-r--r--src/libcore/macros.rs12
4 files changed, 15 insertions, 22 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 9b8b59ec8ce..859cab4225e 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -64,7 +64,6 @@ use option::Option::{self, Some, None};
 /// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`.
 #[lang="eq"]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[old_orphan_check]
 pub trait PartialEq<Rhs: ?Sized = Self> {
     /// This method tests for `self` and `other` values to be equal, and is used by `==`.
     #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libcore/cmp_macros.rs b/src/libcore/cmp_macros.rs
index 18357bac9e6..95dab3d165a 100644
--- a/src/libcore/cmp_macros.rs
+++ b/src/libcore/cmp_macros.rs
@@ -15,8 +15,11 @@
 #[macro_export]
 macro_rules! __impl_slice_eq1 {
     ($Lhs: ty, $Rhs: ty) => {
+        __impl_slice_eq1! { $Lhs, $Rhs, Sized }
+    };
+    ($Lhs: ty, $Rhs: ty, $Bound: ident) => {
         #[stable(feature = "rust1", since = "1.0.0")]
-        impl<'a, 'b, A, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
+        impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
             #[inline]
             fn eq(&self, other: &$Rhs) -> bool { &self[..] == &other[..] }
             #[inline]
@@ -31,13 +34,7 @@ macro_rules! __impl_slice_eq2 {
         __impl_slice_eq2! { $Lhs, $Rhs, Sized }
     };
     ($Lhs: ty, $Rhs: ty, $Bound: ident) => {
-        #[stable(feature = "rust1", since = "1.0.0")]
-        impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
-            #[inline]
-            fn eq(&self, other: &$Rhs) -> bool { &self[..] == &other[..] }
-            #[inline]
-            fn ne(&self, other: &$Rhs) -> bool { &self[..] != &other[..] }
-        }
+        __impl_slice_eq1!($Lhs, $Rhs, $Bound);
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<'a, 'b, A: $Bound, B> PartialEq<$Lhs> for $Rhs where B: PartialEq<A> {
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 44d48f9f4bf..1495d1d584e 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -530,10 +530,9 @@ pub trait Iterator {
     /// # Examples
     ///
     /// ```
-    /// # #![feature(core)]
-    /// let a = [1, 2, 3, 4, 5];
-    /// let b: Vec<_> = a.iter().cloned().collect();
-    /// assert_eq!(a, b);
+    /// let expected = [1, 2, 3, 4, 5];
+    /// let actual: Vec<_> = expected.iter().cloned().collect();
+    /// assert_eq!(actual, expected);
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -927,8 +926,8 @@ pub trait Iterator {
     /// # #![feature(core)]
     /// let a = [(1, 2), (3, 4)];
     /// let (left, right): (Vec<_>, Vec<_>) = a.iter().cloned().unzip();
-    /// assert_eq!([1, 3], left);
-    /// assert_eq!([2, 4], right);
+    /// assert_eq!(left, [1, 3]);
+    /// assert_eq!(right, [2, 4]);
     /// ```
     #[unstable(feature = "core", reason = "recent addition")]
     fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index d5a7c1d6b26..e8959299d72 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -66,10 +66,10 @@ macro_rules! assert {
     );
 }
 
-/// Asserts that two expressions are equal to each other, testing equality in
-/// both directions.
+/// Asserts that two expressions are equal to each other.
 ///
-/// On panic, this macro will print the values of the expressions.
+/// On panic, this macro will print the values of the expressions with their
+/// debug representations.
 ///
 /// # Examples
 ///
@@ -84,10 +84,8 @@ macro_rules! assert_eq {
     ($left:expr , $right:expr) => ({
         match (&($left), &($right)) {
             (left_val, right_val) => {
-                // check both directions of equality....
-                if !((*left_val == *right_val) &&
-                     (*right_val == *left_val)) {
-                    panic!("assertion failed: `(left == right) && (right == left)` \
+                if !(*left_val == *right_val) {
+                    panic!("assertion failed: `(left == right)` \
                            (left: `{:?}`, right: `{:?}`)", *left_val, *right_val)
                 }
             }