]> git.lizzy.rs Git - rust.git/commitdiff
Add test for metavariable hygiene.
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Sun, 7 Aug 2016 06:28:05 +0000 (06:28 +0000)
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Sun, 7 Aug 2016 06:54:56 +0000 (06:54 +0000)
src/test/compile-fail/macro-tt-matchers.rs

index f41da77ee989655e9b28f9424d13a8257cb79b4e..945490cefb95a80ece1c29dea3e4dea0244a2419 100644 (file)
@@ -16,5 +16,16 @@ macro_rules! foo {
 
 foo!(Box);
 
+macro_rules! bar {
+    ($x:tt) => {
+        macro_rules! baz {
+            ($x:tt, $y:tt) => { ($x, $y) }
+        }
+    }
+}
+
 #[rustc_error]
-fn main() {} //~ ERROR compilation successful
+fn main() { //~ ERROR compilation successful
+    bar!($y);
+    let _: (i8, i16) = baz!(0i8, 0i16);
+}