summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/nested_macro_privacy.rs
blob: dea9101ee00687a560b1dec934822bd59ec98ef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![feature(decl_macro)]

macro n($foo:ident, $S:ident, $i:ident, $m:ident) {
    mod $foo {
        #[derive(Default)]
        pub struct $S { $i: u32 }
        pub macro $m($e:expr) { $e.$i }
    }
}

n!(foo, S, i, m);

fn main() {
    use foo::{S, m};
    S::default().i; //~ ERROR field `i` of struct `S` is private
    m!(S::default()); // ok
}