mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
433da1fc04
They pass fine.
21 lines
375 B
Rust
21 lines
375 B
Rust
#![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");
|
|
}
|
|
}
|
|
}
|