]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / issue-54109-and_instead_of_ampersands.rs
1 fn main() {}
2
3 fn test_and() {
4     let a = true;
5     let b = false;
6
7     let _ = a and b; //~ ERROR `and` is not a logical operator
8
9     if a and b { //~ ERROR `and` is not a logical operator
10         println!("both");
11     }
12
13     let _recovery_witness: () = 0; //~ ERROR mismatched types
14 }
15
16 fn test_or() {
17     let a = true;
18     let b = false;
19
20     let _ = a or b; //~ ERROR `or` is not a logical operator
21
22     if a or b { //~ ERROR `or` is not a logical operator
23         println!("both");
24     }
25 }
26
27 fn test_and_par() {
28     let a = true;
29     let b = false;
30     if (a and b) {  //~ ERROR `and` is not a logical operator
31         println!("both");
32     }
33 }
34
35 fn test_or_par() {
36     let a = true;
37     let b = false;
38     if (a or b) {  //~ ERROR `or` is not a logical operator
39         println!("both");
40     }
41 }
42
43 fn test_while_and() {
44     let a = true;
45     let b = false;
46     while a and b {  //~ ERROR `and` is not a logical operator
47         println!("both");
48     }
49 }
50
51 fn test_while_or() {
52     let a = true;
53     let b = false;
54     while a or b { //~ ERROR `or` is not a logical operator
55         println!("both");
56     }
57 }