summaryrefslogtreecommitdiffstats
path: root/src/test/run-make-fulldeps/link-cfg/no-deps.rs
blob: ba5a8711a2610aa10fbb0681f813fa653d5a2f30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(link_cfg)]

#[link(name = "return1", cfg(foo))]
#[link(name = "return2", cfg(bar))]
extern "C" {
    fn my_function() -> i32;
}

fn main() {
    unsafe {
        let v = my_function();
        if cfg!(foo) {
            assert_eq!(v, 1);
        } else if cfg!(bar) {
            assert_eq!(v, 2);
        } else {
            panic!("unknown");
        }
    }
}