summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/macro-metavars-legacy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/hygiene/macro-metavars-legacy.rs')
-rw-r--r--tests/ui/hygiene/macro-metavars-legacy.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/hygiene/macro-metavars-legacy.rs b/tests/ui/hygiene/macro-metavars-legacy.rs
new file mode 100644
index 000000000..09070f0f5
--- /dev/null
+++ b/tests/ui/hygiene/macro-metavars-legacy.rs
@@ -0,0 +1,29 @@
+// Ensure macro metavariables are compared with legacy hygiene
+
+#![feature(rustc_attrs)]
+
+// run-pass
+
+macro_rules! make_mac {
+ ( $($dollar:tt $arg:ident),+ ) => {
+ macro_rules! mac {
+ ( $($dollar $arg : ident),+ ) => {
+ $( $dollar $arg )-+
+ }
+ }
+ }
+}
+
+macro_rules! show_hygiene {
+ ( $dollar:tt $arg:ident ) => {
+ make_mac!($dollar $arg, $dollar arg);
+ }
+}
+
+show_hygiene!( $arg );
+
+fn main() {
+ let x = 5;
+ let y = 3;
+ assert_eq!(2, mac!(x, y));
+}