From cdbfe9fce300b9a28e7f2106bcb85df38d72ae66 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Sun, 7 Aug 2016 06:28:05 +0000 Subject: [PATCH] Add test for metavariable hygiene. --- src/test/compile-fail/macro-tt-matchers.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/compile-fail/macro-tt-matchers.rs b/src/test/compile-fail/macro-tt-matchers.rs index f41da77ee9896..945490cefb95a 100644 --- a/src/test/compile-fail/macro-tt-matchers.rs +++ b/src/test/compile-fail/macro-tt-matchers.rs @@ -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); +}