@@ -535,12 +535,25 @@ impl<T> Extend<T> for Vec<T> {
535
535
}
536
536
}
537
537
538
- #[ unstable = "waiting on PartialEq stability" ]
539
- impl < T : PartialEq > PartialEq for Vec < T > {
538
+ impl < A , B , Rhs > PartialEq < Rhs > for Vec < A > where A : PartialEq < B > , Rhs : Deref < [ B ] > {
540
539
#[ inline]
541
- fn eq ( & self , other : & Vec < T > ) -> bool {
542
- self . as_slice ( ) == other. as_slice ( )
543
- }
540
+ fn eq ( & self , other : & Rhs ) -> bool { PartialEq :: eq ( & * * self , & * * other) }
541
+ #[ inline]
542
+ fn ne ( & self , other : & Rhs ) -> bool { PartialEq :: ne ( & * * self , & * * other) }
543
+ }
544
+
545
+ impl < ' a , A , B > PartialEq < Vec < B > > for & ' a [ A ] where A : PartialEq < B > {
546
+ #[ inline]
547
+ fn eq ( & self , other : & Vec < B > ) -> bool { PartialEq :: eq ( * self , & * * other) }
548
+ #[ inline]
549
+ fn ne ( & self , other : & Vec < B > ) -> bool { PartialEq :: ne ( * self , & * * other) }
550
+ }
551
+
552
+ impl < ' a , A , B > PartialEq < Vec < B > > for & ' a mut [ A ] where A : PartialEq < B > {
553
+ #[ inline]
554
+ fn eq ( & self , other : & Vec < B > ) -> bool { PartialEq :: eq ( & * * self , & * * other) }
555
+ #[ inline]
556
+ fn ne ( & self , other : & Vec < B > ) -> bool { PartialEq :: ne ( & * * self , & * * other) }
544
557
}
545
558
546
559
#[ unstable = "waiting on PartialOrd stability" ]
@@ -554,7 +567,8 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
554
567
#[ unstable = "waiting on Eq stability" ]
555
568
impl < T : Eq > Eq for Vec < T > { }
556
569
557
- #[ experimental]
570
+ #[ allow( deprecated) ]
571
+ #[ deprecated = "Use overloaded `core::cmp::PartialEq`" ]
558
572
impl < T : PartialEq , Sized ? V : AsSlice < T > > Equiv < V > for Vec < T > {
559
573
#[ inline]
560
574
fn equiv ( & self , other : & V ) -> bool { self . as_slice ( ) == other. as_slice ( ) }
@@ -1813,27 +1827,27 @@ mod tests {
1813
1827
let mut values = vec ! [ 1u8 , 2 , 3 , 4 , 5 ] ;
1814
1828
{
1815
1829
let slice = values. slice_from_mut ( 2 ) ;
1816
- assert ! ( slice == & mut [ 3 , 4 , 5 ] ) ;
1830
+ assert ! ( slice == [ 3 , 4 , 5 ] ) ;
1817
1831
for p in slice. iter_mut ( ) {
1818
1832
* p += 2 ;
1819
1833
}
1820
1834
}
1821
1835
1822
- assert ! ( values. as_slice( ) == & [ 1 , 2 , 5 , 6 , 7 ] ) ;
1836
+ assert ! ( values. as_slice( ) == [ 1 , 2 , 5 , 6 , 7 ] ) ;
1823
1837
}
1824
1838
1825
1839
#[ test]
1826
1840
fn test_slice_to_mut ( ) {
1827
1841
let mut values = vec ! [ 1u8 , 2 , 3 , 4 , 5 ] ;
1828
1842
{
1829
1843
let slice = values. slice_to_mut ( 2 ) ;
1830
- assert ! ( slice == & mut [ 1 , 2 ] ) ;
1844
+ assert ! ( slice == [ 1 , 2 ] ) ;
1831
1845
for p in slice. iter_mut ( ) {
1832
1846
* p += 1 ;
1833
1847
}
1834
1848
}
1835
1849
1836
- assert ! ( values. as_slice( ) == & [ 2 , 3 , 3 , 4 , 5 ] ) ;
1850
+ assert ! ( values. as_slice( ) == [ 2 , 3 , 3 , 4 , 5 ] ) ;
1837
1851
}
1838
1852
1839
1853
#[ test]
0 commit comments