about summary refs log tree commit diff
path: root/tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs
diff options
context:
space:
mode:
authorCaio <c410.f3r@gmail.com>2024-06-13 22:12:26 -0300
committerCaio <c410.f3r@gmail.com>2024-06-13 22:12:26 -0300
commit4b82afb40c91fafdc9e4d84d4782573f848d84d9 (patch)
tree7d2c67d77f9887f857132045100440280dcd61c0 /tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs
parent02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1 (diff)
downloadrust-4b82afb40c91fafdc9e4d84d4782573f848d84d9.tar.gz
rust-4b82afb40c91fafdc9e4d84d4782573f848d84d9.zip
Add a new concat metavar expr
Diffstat (limited to 'tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs')
-rw-r--r--tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs b/tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs
new file mode 100644
index 00000000000..f72b9baca89
--- /dev/null
+++ b/tests/ui/macros/macro-metavar-expr-concat/raw-identifiers.rs
@@ -0,0 +1,81 @@
+#![feature(macro_metavar_expr_concat)]
+
+macro_rules! idents_01 {
+    ($rhs:ident) => {
+        let ${concat(abc, $rhs)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! idents_10 {
+    ($lhs:ident) => {
+        let ${concat($lhs, abc)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! idents_11 {
+    ($lhs:ident, $rhs:ident) => {
+        let ${concat($lhs, $rhs)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+        //~| ERROR `${concat(..)}` currently does not support raw identifiers
+        //~| ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! no_params {
+    () => {
+        let ${concat(r#abc, abc)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+        //~| ERROR expected pattern, found `$`
+
+        let ${concat(abc, r#abc)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+
+        let ${concat(r#abc, r#abc)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! tts_01 {
+    ($rhs:tt) => {
+        let ${concat(abc, $rhs)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! tts_10 {
+    ($lhs:tt) => {
+        let ${concat($lhs, abc)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+macro_rules! tts_11 {
+    ($lhs:tt, $rhs:tt) => {
+        let ${concat($lhs, $rhs)}: () = ();
+        //~^ ERROR `${concat(..)}` currently does not support raw identifiers
+        //~| ERROR `${concat(..)}` currently does not support raw identifiers
+        //~| ERROR `${concat(..)}` currently does not support raw identifiers
+    };
+}
+
+fn main() {
+    idents_01!(r#_c);
+
+    idents_10!(r#_c);
+
+    idents_11!(r#_c, d);
+    idents_11!(_e, r#f);
+    idents_11!(r#_g, r#h);
+
+    tts_01!(r#_c);
+
+    tts_10!(r#_c);
+
+    tts_11!(r#_c, d);
+    tts_11!(_e, r#f);
+    tts_11!(r#_g, r#h);
+
+    no_params!();
+}