about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-07-04 20:37:17 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-07-05 13:45:12 +0200
commit22fd6a6abf1f97b488278cd142cc7fe721beb92a (patch)
tree5dae9fdde54743203af3b05a6b4e68fd4168073a /tests
parent3788b7ab32a6398e7563557f7b32f741f43704a3 (diff)
downloadrust-22fd6a6abf1f97b488278cd142cc7fe721beb92a.tar.gz
rust-22fd6a6abf1f97b488278cd142cc7fe721beb92a.zip
Add regression test
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs
new file mode 100644
index 00000000000..2a4cd600426
--- /dev/null
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs
@@ -0,0 +1,24 @@
+// Regression test for issue #113235.
+
+// check-pass
+// revisions: edition2015 edition2018
+//[edition2015] edition: 2015
+//[edition2018] edition: 2018
+
+// Make sure that in pre-2021 editions we continue to parse the snippet
+// `c"hello"` as an identifier followed by a (normal) string literal and
+// allow the code below to compile.
+// Prefixes including `c` as used by C string literals are only reserved
+// in edition 2021 and onward.
+//
+// Consider checking out rust-2021/reserved-prefixes-migration.rs as well.
+
+macro_rules! parse {
+    (c $e:expr) => {
+        $e
+    };
+}
+
+fn main() {
+    let _: &'static str = parse!(c"hello");
+}