about summary refs log tree commit diff
path: root/tests/ui/macros/cfg_select.rs
blob: 461d2e0e8c1f50f9946b1950f1c7d40269da8b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#![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
}

cfg_select! {
    //~^ ERROR none of the predicates in this `cfg_select` evaluated to true
    false => {}
}

cfg_select! {}
//~^ ERROR none of the predicates in this `cfg_select` evaluated to true