mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
31 lines
473 B
Rust
31 lines
473 B
Rust
//@ run-pass
|
|
|
|
#![feature(link_cfg)]
|
|
#![feature(cfg_boolean_literals)]
|
|
|
|
#[cfg(true)]
|
|
fn foo() -> bool {
|
|
cfg!(true)
|
|
}
|
|
|
|
#[cfg(false)]
|
|
fn foo() -> bool {
|
|
cfg!(false)
|
|
}
|
|
|
|
#[cfg_attr(true, cfg(false))]
|
|
fn foo() {}
|
|
|
|
#[link(name = "foo", cfg(false))]
|
|
extern "C" {}
|
|
|
|
fn main() {
|
|
assert!(foo());
|
|
assert!(cfg!(true));
|
|
assert!(!cfg!(false));
|
|
assert!(cfg!(not(false)));
|
|
assert!(cfg!(all(true)));
|
|
assert!(cfg!(any(true)));
|
|
assert!(!cfg!(not(true)));
|
|
}
|