summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/comparison_expr1.rs
blob: ed71ec890253525dede896ce39a87470d55606ff (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
31
32
33
34
35
36
37
38
fn is_zero(x: i32) -> bool {
    x == 0
}

fn is_not_zero(x: i32) -> bool {
    x != 0
}

fn is_positive(x: i32) -> bool {
    x > 0
}

fn is_negative(x: i32) -> bool {
    x < 0
}

fn is_positive_or_zero(x: i32) -> bool {
    x >= 0
}

fn is_negative_or_zero(x: i32) -> bool {
    x <= 0
}

fn main() {
    let a: bool = is_zero(1);
    let b: bool = is_not_zero(2);
    let c: bool = is_positive(3);
    let d: bool = is_negative(4);
    let e: bool = is_positive_or_zero(5);
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
    let f: bool = is_negative_or_zero(6);
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
    let g: bool = a || b;
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
    let h: bool = c && d;
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}