about summary refs log tree commit diff
path: root/tests/ui/macros/issue-61053-unbound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros/issue-61053-unbound.rs')
-rw-r--r--tests/ui/macros/issue-61053-unbound.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/macros/issue-61053-unbound.rs b/tests/ui/macros/issue-61053-unbound.rs
new file mode 100644
index 00000000000..b75cdce0cf4
--- /dev/null
+++ b/tests/ui/macros/issue-61053-unbound.rs
@@ -0,0 +1,28 @@
+#![deny(meta_variable_misuse)]
+
+macro_rules! foo {
+    () => {};
+    ($( $i:ident = $($j:ident),+ );*) => { $( $( $i = $k; )+ )* };
+    //~^ ERROR unknown macro variable
+}
+
+macro_rules! bar {
+    () => {};
+    (test) => {
+        macro_rules! nested {
+            () => {};
+            ($( $i:ident = $($j:ident),+ );*) => { $( $( $i = $k; )+ )* };
+            //~^ ERROR unknown macro variable
+        }
+    };
+    ( $( $i:ident = $($j:ident),+ );* ) => {
+        $(macro_rules! $i {
+            () => { $( $i = $k)+ }; //~ ERROR unknown macro variable
+        })*
+    };
+}
+
+fn main() {
+    foo!();
+    bar!();
+}