summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs
blob: 44421b077fa26eb2c0e75f664c07be4d45cbd76f (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
fn main() {}

fn test_and() {
    let a = true;
    let b = false;

    let _ = a and b; //~ ERROR `and` is not a logical operator

    if a and b { //~ ERROR `and` is not a logical operator
        println!("both");
    }

    let _recovery_witness: () = 0; //~ ERROR mismatched types
}

fn test_or() {
    let a = true;
    let b = false;

    let _ = a or b; //~ ERROR `or` is not a logical operator

    if a or b { //~ ERROR `or` is not a logical operator
        println!("both");
    }
}

fn test_and_par() {
    let a = true;
    let b = false;
    if (a and b) {  //~ ERROR `and` is not a logical operator
        println!("both");
    }
}

fn test_or_par() {
    let a = true;
    let b = false;
    if (a or b) {  //~ ERROR `or` is not a logical operator
        println!("both");
    }
}

fn test_while_and() {
    let a = true;
    let b = false;
    while a and b {  //~ ERROR `and` is not a logical operator
        println!("both");
    }
}

fn test_while_or() {
    let a = true;
    let b = false;
    while a or b { //~ ERROR `or` is not a logical operator
        println!("both");
    }
}