about summary refs log tree commit diff
path: root/src/libcore/array.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-23 20:47:30 +0000
committerbors <bors@rust-lang.org>2015-02-23 20:47:30 +0000
commit91a5a1ab4ad054c8dccf49f6f409542f82683cfc (patch)
tree1c2a90b8e1aac6793a0fbf6350778a5b9ac65dae /src/libcore/array.rs
parentf0f7ca27de6b4e03f30012656dad270cda55a363 (diff)
parentee6f2a1ad6ab79ed954cd96fff6eaddcdfb6a043 (diff)
downloadrust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.tar.gz
rust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.zip
Auto merge of #22724 - Manishearth:rollup, r=alexcrichton
Seems to pass `check-stage1`, but I had to tweak some things so it's going through the test gauntlet again.
Diffstat (limited to 'src/libcore/array.rs')
-rw-r--r--src/libcore/array.rs51
1 files changed, 8 insertions, 43 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index e8f6e31756d..0d98cff7e6a 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -19,8 +19,7 @@ use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use fmt;
 use hash::{Hash, self};
 use iter::IntoIterator;
-use marker::Copy;
-use ops::Deref;
+use marker::{Copy, Sized};
 use option::Option;
 use slice::{Iter, IterMut, SliceExt};
 
@@ -69,47 +68,13 @@ macro_rules! array_impls {
                 }
             }
 
-            #[stable(feature = "rust1", since = "1.0.0")]
-            impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
-                #[inline]
-                fn eq(&self, other: &[B; $N]) -> bool {
-                    &self[..] == &other[..]
-                }
-                #[inline]
-                fn ne(&self, other: &[B; $N]) -> bool {
-                    &self[..] != &other[..]
-                }
-            }
-
-            #[stable(feature = "rust1", since = "1.0.0")]
-            impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
-                A: PartialEq<B>,
-                Rhs: Deref<Target=[B]>,
-            {
-                #[inline(always)]
-                fn eq(&self, other: &Rhs) -> bool {
-                    PartialEq::eq(&self[..], &**other)
-                }
-                #[inline(always)]
-                fn ne(&self, other: &Rhs) -> bool {
-                    PartialEq::ne(&self[..], &**other)
-                }
-            }
-
-            #[stable(feature = "rust1", since = "1.0.0")]
-            impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
-                A: PartialEq<B>,
-                Lhs: Deref<Target=[A]>
-            {
-                #[inline(always)]
-                fn eq(&self, other: &[B; $N]) -> bool {
-                    PartialEq::eq(&**self, &other[..])
-                }
-                #[inline(always)]
-                fn ne(&self, other: &[B; $N]) -> bool {
-                    PartialEq::ne(&**self, &other[..])
-                }
-            }
+            // NOTE: some less important impls are omitted to reduce code bloat
+            __impl_slice_eq1! { [A; $N], [B; $N] }
+            __impl_slice_eq2! { [A; $N], [B] }
+            __impl_slice_eq2! { [A; $N], &'b [B] }
+            __impl_slice_eq2! { [A; $N], &'b mut [B] }
+            // __impl_slice_eq2! { [A; $N], &'b [B; $N] }
+            // __impl_slice_eq2! { [A; $N], &'b mut [B; $N] }
 
             #[stable(feature = "rust1", since = "1.0.0")]
             impl<T:Eq> Eq for [T; $N] { }