File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -909,7 +909,8 @@ impl Token {
909909 self . is_keyword ( kw)
910910 || ( case == Case :: Insensitive
911911 && self . is_non_raw_ident_where ( |id| {
912- id. name . as_str ( ) . to_lowercase ( ) == kw. as_str ( ) . to_lowercase ( )
912+ // Do an ASCII case-insensitive match, because all keywords are ASCII.
913+ id. name . as_str ( ) . eq_ignore_ascii_case ( kw. as_str ( ) )
913914 } ) )
914915 }
915916
Original file line number Diff line number Diff line change @@ -655,9 +655,9 @@ impl<'a> Parser<'a> {
655655 fn check_keyword_case ( & mut self , exp : ExpKeywordPair , case : Case ) -> bool {
656656 if self . check_keyword ( exp) {
657657 true
658- // Do an ASCII case-insensitive match, because all keywords are ASCII.
659658 } else if case == Case :: Insensitive
660659 && let Some ( ( ident, IdentIsRaw :: No ) ) = self . token . ident ( )
660+ // Do an ASCII case-insensitive match, because all keywords are ASCII.
661661 && ident. as_str ( ) . eq_ignore_ascii_case ( exp. kw . as_str ( ) )
662662 {
663663 true
@@ -689,7 +689,8 @@ impl<'a> Parser<'a> {
689689 true
690690 } else if case == Case :: Insensitive
691691 && let Some ( ( ident, IdentIsRaw :: No ) ) = self . token . ident ( )
692- && ident. as_str ( ) . to_lowercase ( ) == exp. kw . as_str ( ) . to_lowercase ( )
692+ // Do an ASCII case-insensitive match, because all keywords are ASCII.
693+ && ident. as_str ( ) . eq_ignore_ascii_case ( exp. kw . as_str ( ) )
693694 {
694695 self . dcx ( ) . emit_err ( errors:: KwBadCase { span : ident. span , kw : exp. kw . as_str ( ) } ) ;
695696 self . bump ( ) ;
You can’t perform that action at this time.
0 commit comments