summary refs log tree commit diff
path: root/src/test/compile-fail/macro-inner-attributes.rs
blob: d8fbb8b879c6ec34d853713efd24f00a8726ac98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[feature(macro_rules)];

macro_rules! test ( ($nm:ident,
                     $a:attr,
                     $i:item) => (mod $nm { $a; $i }); )

test!(a,
      #[cfg(qux)],
      pub fn bar() { })

test!(b,
      #[cfg(not(qux))],
      pub fn bar() { })

#[qux]
fn main() {
    a::bar();
    //~^ ERROR use of undeclared module `a`
    //~^^ ERROR unresolved name
    //~^^^ ERROR unresolved name `a::bar`
    b::bar();
}