about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-06-14 16:50:20 +0000
committerlrh2000 <lrh2000@pku.edu.cn>2021-06-26 23:11:14 +0800
commit0eeeebc990719b666a5cf4e3e488c79751596f87 (patch)
tree36c3658edee80142ad42c78542f961ecf9266187 /compiler/rustc_lexer/src
parentd40be0fc6418affeeb765a9b6a99315e90aa57c8 (diff)
downloadrust-0eeeebc990719b666a5cf4e3e488c79751596f87.tar.gz
rust-0eeeebc990719b666a5cf4e3e488c79751596f87.zip
Rename 'bad prefix' to 'unknown prefix'.
Diffstat (limited to 'compiler/rustc_lexer/src')
-rw-r--r--compiler/rustc_lexer/src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs
index 4a8f34e2815..4cb2a6ca50f 100644
--- a/compiler/rustc_lexer/src/lib.rs
+++ b/compiler/rustc_lexer/src/lib.rs
@@ -72,7 +72,7 @@ pub enum TokenKind {
     /// prefixes are reported as errors; in earlier editions, they result in a
     /// (allowed by default) lint, and are treated as regular identifier
     /// tokens.
-    BadPrefix,
+    UnknownPrefix,
     /// "12_u8", "1.0e-40", "b"123"". See `LiteralKind` for more details.
     Literal { kind: LiteralKind, suffix_start: usize },
     /// "'a"
@@ -330,7 +330,7 @@ impl Cursor<'_> {
                     let kind = RawStr { n_hashes, err };
                     Literal { kind, suffix_start }
                 }
-                _ => self.ident_or_bad_prefix(),
+                _ => self.ident_or_unknown_prefix(),
             },
 
             // Byte literal, byte string literal, raw byte string literal or identifier.
@@ -365,12 +365,12 @@ impl Cursor<'_> {
                     let kind = RawByteStr { n_hashes, err };
                     Literal { kind, suffix_start }
                 }
-                _ => self.ident_or_bad_prefix(),
+                _ => self.ident_or_unknown_prefix(),
             },
 
             // Identifier (this should be checked after other variant that can
             // start as identifier).
-            c if is_id_start(c) => self.ident_or_bad_prefix(),
+            c if is_id_start(c) => self.ident_or_unknown_prefix(),
 
             // Numeric literal.
             c @ '0'..='9' => {
@@ -494,14 +494,14 @@ impl Cursor<'_> {
         RawIdent
     }
 
-    fn ident_or_bad_prefix(&mut self) -> TokenKind {
+    fn ident_or_unknown_prefix(&mut self) -> TokenKind {
         debug_assert!(is_id_start(self.prev()));
         // Start is already eaten, eat the rest of identifier.
         self.eat_while(is_id_continue);
-        // Good prefixes must have been handled earlier. So if
-        // we see a prefix here, it is definitely a bad prefix.
+        // Known prefixes must have been handled earlier. So if
+        // we see a prefix here, it is definitely a unknown prefix.
         match self.first() {
-            '#' | '"' | '\'' => BadPrefix,
+            '#' | '"' | '\'' => UnknownPrefix,
             _ => Ident,
         }
     }