2024-09-19 03:13:14 -05:00
|
|
|
//@ run-pass
|
|
|
|
|
|
|
|
#![feature(link_cfg)]
|
2024-09-19 04:19:35 -05:00
|
|
|
#![feature(cfg_boolean_literals)]
|
2024-09-19 03:13:14 -05:00
|
|
|
|
|
|
|
#[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)));
|
|
|
|
}
|