rust/tests/ui/cfg/true-false.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
473 B
Rust
Raw Normal View History

//@ 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)));
}