@@ -5946,8 +5946,7 @@ where
5946
5946
}
5947
5947
}
5948
5948
5949
- // Remove after boostrap bump
5950
- #[ cfg( bootstrap) ]
5949
+ // Use an equal-pointer optimization when types are `Eq`
5951
5950
impl < A > SlicePartialEq < A > for [ A ]
5952
5951
where
5953
5952
A : PartialEq < A > + Eq ,
@@ -5957,47 +5956,14 @@ where
5957
5956
return false ;
5958
5957
}
5959
5958
5959
+ #[ cfg( bootstrap) ]
5960
5960
if self . as_ptr ( ) == other. as_ptr ( ) {
5961
5961
return true ;
5962
5962
}
5963
5963
5964
- self . iter ( ) . zip ( other. iter ( ) ) . all ( |( x, y) | x == y)
5965
- }
5966
- }
5967
-
5968
- // Remove after boostrap bump
5969
- #[ cfg( bootstrap) ]
5970
- impl < A > SlicePartialEq < A > for [ A ]
5971
- where
5972
- A : PartialEq < A > + BytewiseEquality ,
5973
- {
5974
- fn equal ( & self , other : & [ A ] ) -> bool {
5975
- if self . len ( ) != other. len ( ) {
5976
- return false ;
5977
- }
5978
- if self . as_ptr ( ) == other. as_ptr ( ) {
5979
- return true ;
5980
- }
5981
- unsafe {
5982
- let size = mem:: size_of_val ( self ) ;
5983
- memcmp ( self . as_ptr ( ) as * const u8 , other. as_ptr ( ) as * const u8 , size) == 0
5984
- }
5985
- }
5986
- }
5987
-
5988
- // Use an equal-pointer optimization when types are `Eq`
5989
- #[ cfg( not( bootstrap) ) ]
5990
- impl < A > SlicePartialEq < A > for [ A ]
5991
- where
5992
- A : PartialEq < A > + Eq ,
5993
- {
5994
- default fn equal ( & self , other : & [ A ] ) -> bool {
5995
- if self . len ( ) != other. len ( ) {
5996
- return false ;
5997
- }
5998
-
5999
5964
// While performance would suffer if `guaranteed_eq` just returned `false`
6000
5965
// for all arguments, correctness and return value of this function are not affected.
5966
+ #[ cfg( not( bootstrap) ) ]
6001
5967
if self . as_ptr ( ) . guaranteed_eq ( other. as_ptr ( ) ) {
6002
5968
return true ;
6003
5969
}
@@ -6007,7 +5973,6 @@ where
6007
5973
}
6008
5974
6009
5975
// Use memcmp for bytewise equality when the types allow
6010
- #[ cfg( not( bootstrap) ) ]
6011
5976
impl < A > SlicePartialEq < A > for [ A ]
6012
5977
where
6013
5978
A : PartialEq < A > + BytewiseEquality ,
@@ -6017,8 +5982,14 @@ where
6017
5982
return false ;
6018
5983
}
6019
5984
5985
+ #[ cfg( bootstrap) ]
5986
+ if self . as_ptr ( ) == other. as_ptr ( ) {
5987
+ return true ;
5988
+ }
5989
+
6020
5990
// While performance would suffer if `guaranteed_eq` just returned `false`
6021
5991
// for all arguments, correctness and return value of this function are not affected.
5992
+ #[ cfg( not( bootstrap) ) ]
6022
5993
if self . as_ptr ( ) . guaranteed_eq ( other. as_ptr ( ) ) {
6023
5994
return true ;
6024
5995
}
0 commit comments