File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -595,7 +595,22 @@ Section: Comparing strings
595
595
*/
596
596
597
597
#[ doc = "Bytewise string equality" ]
598
- pure fn eq ( & & a: str , & & b: str ) -> bool { a == b }
598
+ pure fn eq ( & & a: str , & & b: str ) -> bool {
599
+ // FIXME: This should just be "a == b" but that calls into the shape code
600
+ // :(
601
+ let a_len = a. len ( ) ;
602
+ let b_len = b. len ( ) ;
603
+ if a_len != b_len { ret false ; }
604
+ let mut end = uint:: min ( a_len, b_len) ;
605
+
606
+ let mut i = 0 u;
607
+ while i < end {
608
+ if a[ i] != b[ i] { ret false ; }
609
+ i += 1 u;
610
+ }
611
+
612
+ ret true;
613
+ }
599
614
600
615
#[ doc = "Bytewise less than or equal" ]
601
616
pure fn le ( & & a: str , & & b: str ) -> bool { a <= b }
@@ -1874,7 +1889,7 @@ impl extensions for str {
1874
1889
fn is_alphanumeric ( ) -> bool { is_alphanumeric ( self ) }
1875
1890
#[ inline]
1876
1891
#[ doc ="Returns the size in bytes not counting the null terminator" ]
1877
- fn len ( ) -> uint { len ( self ) }
1892
+ pure fn len ( ) -> uint { len ( self ) }
1878
1893
#[ doc = "
1879
1894
Returns a slice of the given string from the byte range [`begin`..`end`)
1880
1895
You can’t perform that action at this time.
0 commit comments