Files
rust/tests/ui/macros/cfg_select.rs

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

31 lines
561 B
Rust
Raw Normal View History

2025-07-04 23:56:16 +02:00
#![feature(cfg_select)]
#![crate_type = "lib"]
fn print() {
println!(cfg_select! {
unix => { "unix" }
_ => { "not unix" }
});
}
fn arm_rhs_must_be_in_braces() -> i32 {
cfg_select! {
true => 1
//~^ ERROR: expected `{`, found `1`
}
}
cfg_select! {
_ => {}
true => {}
//~^ WARN unreachable predicate
2025-07-04 23:56:16 +02:00
}
cfg_select! {
//~^ ERROR none of the predicates in this `cfg_select` evaluated to true
2025-07-04 23:56:16 +02:00
false => {}
}
cfg_select! {}
//~^ ERROR none of the predicates in this `cfg_select` evaluated to true