summaryrefslogtreecommitdiffstats
path: root/src/test/ui/proc-macro/attr-cfg.rs
blob: 2aed9e2e814de0964ed92b8d206bc21f45faf0df (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
25
26
27
// run-pass
// aux-build:attr-cfg.rs
// revisions: foo bar

extern crate attr_cfg;
use attr_cfg::attr_cfg;

#[attr_cfg]
fn outer() -> u8 {
    #[cfg(foo)]
    fn inner() -> u8 { 1 }

    #[cfg(bar)]
    fn inner() -> u8 { 2 }

    inner()
}

#[cfg(foo)]
fn main() {
    assert_eq!(outer(), 1);
}

#[cfg(bar)]
fn main() {
    assert_eq!(outer(), 2);
}