about summary refs log tree commit diff
path: root/tests/ui/macros/metavar-expressions/concat-raw-identifiers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros/metavar-expressions/concat-raw-identifiers.rs')
-rw-r--r--tests/ui/macros/metavar-expressions/concat-raw-identifiers.rs81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/ui/macros/metavar-expressions/concat-raw-identifiers.rs b/tests/ui/macros/metavar-expressions/concat-raw-identifiers.rs
new file mode 100644
index 00000000000..b1cb2141cc4
--- /dev/null
+++ b/tests/ui/macros/metavar-expressions/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 expected identifier or string literal
+        //~| ERROR expected pattern, found `$`
+
+        let ${concat(abc, r#abc)}: () = ();
+        //~^ ERROR expected identifier or string literal
+
+        let ${concat(r#abc, r#abc)}: () = ();
+        //~^ ERROR expected identifier or string literal
+    };
+}
+
+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!();
+}