]> git.lizzy.rs Git - rust.git/blobdiff - tests/target/macro_rules.rs
allow underscore
[rust.git] / tests / target / macro_rules.rs
index 12fdb7b026e4c1ff4b6595bf021beeb087f1a162..7d527b0c3fdac475b38378174001d597e0bbc511 100644 (file)
@@ -200,3 +200,23 @@ macro_rules! add_message_to_notes {
         }
     }};
 }
+
+// #2560
+macro_rules! binary {
+    ($_self:ident, $expr:expr, $lhs:expr, $func:ident) => {
+        while $_self.matched($expr) {
+            let op = $_self.get_binary_op()?;
+
+            let rhs = Box::new($_self.$func()?);
+
+            $lhs = Spanned {
+                span: $lhs.get_span().to(rhs.get_span()),
+                value: Expression::Binary {
+                    lhs: Box::new($lhs),
+                    op,
+                    rhs,
+                },
+            }
+        }
+    };
+}