summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/macro-metavars-transparent.rs
blob: e475b5728a098d468255d3a562e32bb29a69becc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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));
}