From ec11c27e5c2e296e3806c746e12299b29d59f3fe Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Sun, 14 Apr 2024 17:37:45 -0600
Subject: [PATCH 1/3] Reserve guarded string literals (RFC 3593)
---
crates/parser/src/lexed_str.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/crates/parser/src/lexed_str.rs b/crates/parser/src/lexed_str.rs
index dceac815e0..7ea23b4f75 100644
--- a/crates/parser/src/lexed_str.rs
+++ b/crates/parser/src/lexed_str.rs
@@ -187,6 +187,12 @@ impl<'a> Converter<'a> {
}
rustc_lexer::TokenKind::RawIdent => IDENT,
+
+ rustc_lexer::TokenKind::GuardedStrPrefix => {
+ err = "Invalid string literal (reserved syntax)";
+ ERROR
+ },
+
rustc_lexer::TokenKind::Literal { kind, .. } => {
self.extend_literal(token_text.len(), kind);
return;
From f3fad2af108d7937291633b4b2386f2092d2a933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?=
Date: Thu, 17 Oct 2024 10:04:47 +0300
Subject: [PATCH 2/3] Preparing for merge from rust-lang/rust
---
rust-version | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust-version b/rust-version
index f217c6a19c..d0f9fa7ac4 100644
--- a/rust-version
+++ b/rust-version
@@ -1 +1 @@
-cf24c73141a77db730f4b7fda69dcd7e8b113b51
+dd5127615ad626741a1116d022cf784637ac05df
From 2fe603efe77ff0c67f92dc8fc52c124e90c03e27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?=
Date: Thu, 17 Oct 2024 10:10:01 +0300
Subject: [PATCH 3/3] Bump rustc crates
---
Cargo.lock | 24 ++++++++++++------------
Cargo.toml | 10 +++++-----
crates/parser/src/lexed_str.rs | 5 +++--
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index d09315d906..4a6da47a47 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1497,9 +1497,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_abi"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a8cb51bb4534ac3e9c74f1d9bd90e607e60f94f734b1cf1a66f753ad2af6ed7"
+checksum = "c6999d098000b98415939f13158dac78cb3eeeb7b0c073847f3e4b623866e27c"
dependencies = [
"bitflags 2.6.0",
"ra-ap-rustc_index",
@@ -1508,9 +1508,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_index"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b640fba2b7ef4f875459e2e76daeb846ef341d1d376fa758962ac0eba79bce6"
+checksum = "ae9fb312d942817dab10790881f555928c1f6a11a85186e8e573ad4a86c7d3be"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
@@ -1519,9 +1519,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_index_macros"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "faef502419ba5ac9d3079b1a835c6e5b4e605388254bbe55eb5683936f541be9"
+checksum = "766e3990eb1066a06deefc561b5a01b32ca5c9211feea31cbf4ed50611519872"
dependencies = [
"proc-macro2",
"quote",
@@ -1530,9 +1530,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_lexer"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5da7f9d533b8d5be6704558da741ff20b982ad4647b1e9e08632853e4fecf9d5"
+checksum = "f4afa98eb7889c137d5a3f1cd189089e16da04d1e4837d358a67aa3dab10ffbe"
dependencies = [
"unicode-properties",
"unicode-xid",
@@ -1540,9 +1540,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_parse_format"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94389cf81c651b1bda9ac45d3de6a2d851bb6fd4cb893875daa44e419c94205f"
+checksum = "d9234c96ffb0565286790407fb7eb7f55ebf69267de4db382fdec0a17f14b0e2"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
@@ -1550,9 +1550,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_pattern_analysis"
-version = "0.68.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3679d8dd0114ed6000918309f843782738e51c99d8e4baec0d0f706e4d948819"
+checksum = "273d5f72926a58c7eea27aebc898d1d5b32d23d2342f692a94a2cf8746aa4a2f"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash",
diff --git a/Cargo.toml b/Cargo.toml
index d97d4d4d36..8c099f324b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -85,11 +85,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }
-ra-ap-rustc_lexer = { version = "0.68.0", default-features = false }
-ra-ap-rustc_parse_format = { version = "0.68.0", default-features = false }
-ra-ap-rustc_index = { version = "0.68.0", default-features = false }
-ra-ap-rustc_abi = { version = "0.68.0", default-features = false }
-ra-ap-rustc_pattern_analysis = { version = "0.68.0", default-features = false }
+ra-ap-rustc_lexer = { version = "0.71.0", default-features = false }
+ra-ap-rustc_parse_format = { version = "0.71.0", default-features = false }
+ra-ap-rustc_index = { version = "0.71.0", default-features = false }
+ra-ap-rustc_abi = { version = "0.71.0", default-features = false }
+ra-ap-rustc_pattern_analysis = { version = "0.71.0", default-features = false }
# local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" }
diff --git a/crates/parser/src/lexed_str.rs b/crates/parser/src/lexed_str.rs
index 7ea23b4f75..5322463a71 100644
--- a/crates/parser/src/lexed_str.rs
+++ b/crates/parser/src/lexed_str.rs
@@ -188,10 +188,11 @@ impl<'a> Converter<'a> {
rustc_lexer::TokenKind::RawIdent => IDENT,
- rustc_lexer::TokenKind::GuardedStrPrefix => {
+ rustc_lexer::TokenKind::GuardedStrPrefix if self.edition.at_least_2024() => {
err = "Invalid string literal (reserved syntax)";
ERROR
- },
+ }
+ rustc_lexer::TokenKind::GuardedStrPrefix => POUND,
rustc_lexer::TokenKind::Literal { kind, .. } => {
self.extend_literal(token_text.len(), kind);