diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
commit | 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch) | |
tree | d325add32978dbdc1db975a438b3a77d571b1ab8 /vendor/rustc-ap-rustc_lexer | |
parent | Releasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustc-ap-rustc_lexer')
-rw-r--r-- | vendor/rustc-ap-rustc_lexer/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/rustc-ap-rustc_lexer/Cargo.toml | 4 | ||||
-rw-r--r-- | vendor/rustc-ap-rustc_lexer/src/lib.rs | 22 |
3 files changed, 20 insertions, 8 deletions
diff --git a/vendor/rustc-ap-rustc_lexer/.cargo-checksum.json b/vendor/rustc-ap-rustc_lexer/.cargo-checksum.json index b211139e8..3df6fdfb5 100644 --- a/vendor/rustc-ap-rustc_lexer/.cargo-checksum.json +++ b/vendor/rustc-ap-rustc_lexer/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"dc430a17d2d107587d485d97cd5f15bc1c5cb55d145435d4d7267223c1fd8d33","src/cursor.rs":"1b58d5746e41eb7c58212885260543a359a6aa825b3bc47d8cb9733a75e90158","src/lib.rs":"41ffa950ae7a03f68a0ef610e61faeadd81f7b3d90da0cc999ad18bf0769dd38","src/tests.rs":"0a8e21db0da8e336b41c145652a4a41d235e1c36d5284a10cf837dba2b471c4d","src/unescape.rs":"913036ef4cecc7735de8c2f576dda584b0ba976ca71723fc1590447676b60ac8","src/unescape/tests.rs":"5f73f809bbb287b116c7db1416f01bf54ccdb78882f5f22a1da42f2f48f63af3"},"package":"f950742ef8a203aa7661aad3ab880438ddeb7f95d4b837c30d65db1a2c5df68e"}
\ No newline at end of file +{"files":{"Cargo.toml":"7f25776fe1328d925567faf1db5afd37b8e4cd135492e0b5aece88059202ba81","src/cursor.rs":"1b58d5746e41eb7c58212885260543a359a6aa825b3bc47d8cb9733a75e90158","src/lib.rs":"630b5b8e8c1527912a854903ff8e4ddc10789904698db61f837cef7fc21f2181","src/tests.rs":"0a8e21db0da8e336b41c145652a4a41d235e1c36d5284a10cf837dba2b471c4d","src/unescape.rs":"913036ef4cecc7735de8c2f576dda584b0ba976ca71723fc1590447676b60ac8","src/unescape/tests.rs":"5f73f809bbb287b116c7db1416f01bf54ccdb78882f5f22a1da42f2f48f63af3"},"package":"8f40f26e7abdcd3b982f36c09a634cc6187988fbf6ec466c91f8d30a12ac0237"}
\ No newline at end of file diff --git a/vendor/rustc-ap-rustc_lexer/Cargo.toml b/vendor/rustc-ap-rustc_lexer/Cargo.toml index f11e5ce15..fd16ad110 100644 --- a/vendor/rustc-ap-rustc_lexer/Cargo.toml +++ b/vendor/rustc-ap-rustc_lexer/Cargo.toml @@ -13,9 +13,9 @@ [package] edition = "2018" name = "rustc-ap-rustc_lexer" -version = "725.0.0" +version = "727.0.0" authors = ["The Rust Project Developers"] -description = "Automatically published version of the package `rustc_lexer` in the rust-lang/rust repository from commit c38111c4fb9c22a36f9a9195d1884052bb670af2 The publishing script for this crate lives at: https://github.com/alexcrichton/rustc-auto-publish\n " +description = "Automatically published version of the package `rustc_lexer` in the rust-lang/rust repository from commit 9a27044f42ace9eb652781b53f598e25d4e7e918 The publishing script for this crate lives at: https://github.com/alexcrichton/rustc-auto-publish\n " license = "MIT / Apache-2.0" repository = "https://github.com/rust-lang/rust" diff --git a/vendor/rustc-ap-rustc_lexer/src/lib.rs b/vendor/rustc-ap-rustc_lexer/src/lib.rs index b9781581f..4cb2a6ca5 100644 --- a/vendor/rustc-ap-rustc_lexer/src/lib.rs +++ b/vendor/rustc-ap-rustc_lexer/src/lib.rs @@ -66,6 +66,13 @@ pub enum TokenKind { Ident, /// "r#ident" RawIdent, + /// An unknown prefix like `foo#`, `foo'`, `foo"`. Note that only the + /// prefix (`foo`) is included in the token, not the separator (which is + /// lexed as its own distinct token). In Rust 2021 and later, reserved + /// prefixes are reported as errors; in earlier editions, they result in a + /// (allowed by default) lint, and are treated as regular identifier + /// tokens. + UnknownPrefix, /// "12_u8", "1.0e-40", "b"123"". See `LiteralKind` for more details. Literal { kind: LiteralKind, suffix_start: usize }, /// "'a" @@ -323,7 +330,7 @@ impl Cursor<'_> { let kind = RawStr { n_hashes, err }; Literal { kind, suffix_start } } - _ => self.ident(), + _ => self.ident_or_unknown_prefix(), }, // Byte literal, byte string literal, raw byte string literal or identifier. @@ -358,12 +365,12 @@ impl Cursor<'_> { let kind = RawByteStr { n_hashes, err }; Literal { kind, suffix_start } } - _ => self.ident(), + _ => 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(), + c if is_id_start(c) => self.ident_or_unknown_prefix(), // Numeric literal. c @ '0'..='9' => { @@ -487,11 +494,16 @@ impl Cursor<'_> { RawIdent } - fn ident(&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); - Ident + // Known prefixes must have been handled earlier. So if + // we see a prefix here, it is definitely a unknown prefix. + match self.first() { + '#' | '"' | '\'' => UnknownPrefix, + _ => Ident, + } } fn number(&mut self, first_digit: char) -> LiteralKind { |