summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/macro-metavars-transparent.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/hygiene/macro-metavars-transparent.rs')
-rw-r--r--tests/ui/hygiene/macro-metavars-transparent.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/hygiene/macro-metavars-transparent.rs b/tests/ui/hygiene/macro-metavars-transparent.rs
new file mode 100644
index 000000000..e475b5728
--- /dev/null
+++ b/tests/ui/hygiene/macro-metavars-transparent.rs
@@ -0,0 +1,24 @@
+// Ensure macro metavariables are not compared without removing transparent
+// marks.
+
+#![feature(rustc_attrs)]
+
+// run-pass
+
+#[rustc_macro_transparency = "transparent"]
+macro_rules! k {
+ ($($s:tt)*) => {
+ macro_rules! m {
+ ($y:tt) => {
+ $($s)*
+ }
+ }
+ }
+}
+
+k!(1 + $y);
+
+fn main() {
+ let x = 2;
+ assert_eq!(3, m!(x));
+}