@@ -5946,8 +5946,7 @@ where
59465946 }
59475947}
59485948
5949- // Remove after boostrap bump
5950- #[ cfg( bootstrap) ]
5949+ // Use an equal-pointer optimization when types are `Eq`
59515950impl < A > SlicePartialEq < A > for [ A ]
59525951where
59535952 A : PartialEq < A > + Eq ,
@@ -5957,47 +5956,14 @@ where
59575956 return false ;
59585957 }
59595958
5959+ #[ cfg( bootstrap) ]
59605960 if self . as_ptr ( ) == other. as_ptr ( ) {
59615961 return true ;
59625962 }
59635963
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-
59995964 // While performance would suffer if `guaranteed_eq` just returned `false`
60005965 // for all arguments, correctness and return value of this function are not affected.
5966+ #[ cfg( not( bootstrap) ) ]
60015967 if self . as_ptr ( ) . guaranteed_eq ( other. as_ptr ( ) ) {
60025968 return true ;
60035969 }
@@ -6007,7 +5973,6 @@ where
60075973}
60085974
60095975// Use memcmp for bytewise equality when the types allow
6010- #[ cfg( not( bootstrap) ) ]
60115976impl < A > SlicePartialEq < A > for [ A ]
60125977where
60135978 A : PartialEq < A > + BytewiseEquality ,
@@ -6017,8 +5982,14 @@ where
60175982 return false ;
60185983 }
60195984
5985+ #[ cfg( bootstrap) ]
5986+ if self . as_ptr ( ) == other. as_ptr ( ) {
5987+ return true ;
5988+ }
5989+
60205990 // While performance would suffer if `guaranteed_eq` just returned `false`
60215991 // for all arguments, correctness and return value of this function are not affected.
5992+ #[ cfg( not( bootstrap) ) ]
60225993 if self . as_ptr ( ) . guaranteed_eq ( other. as_ptr ( ) ) {
60235994 return true ;
60245995 }
0 commit comments