]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/chained-comparison-suggestion.rs
Rollup merge of #92024 - pcwalton:per-codegen-unit-names, r=davidtwco
[rust.git] / src / test / ui / parser / chained-comparison-suggestion.rs
1 // Check that we get nice suggestions when attempting a chained comparison.
2
3 fn comp1() {
4     1 < 2 <= 3; //~ ERROR comparison operators cannot be chained
5     //~^ ERROR mismatched types
6 }
7
8 fn comp2() {
9     1 < 2 < 3; //~ ERROR comparison operators cannot be chained
10 }
11
12 fn comp3() {
13     1 <= 2 < 3; //~ ERROR comparison operators cannot be chained
14     //~^ ERROR mismatched types
15 }
16
17 fn comp4() {
18     1 <= 2 <= 3; //~ ERROR comparison operators cannot be chained
19     //~^ ERROR mismatched types
20 }
21
22 fn comp5() {
23     1 > 2 >= 3; //~ ERROR comparison operators cannot be chained
24     //~^ ERROR mismatched types
25 }
26
27 fn comp6() {
28     1 > 2 > 3; //~ ERROR comparison operators cannot be chained
29 }
30
31 fn comp7() {
32     1 >= 2 > 3; //~ ERROR comparison operators cannot be chained
33 }
34
35 fn comp8() {
36     1 >= 2 >= 3; //~ ERROR comparison operators cannot be chained
37     //~^ ERROR mismatched types
38 }
39
40 fn comp9() {
41     1 == 2 < 3; //~ ERROR comparison operators cannot be chained
42 }
43
44 fn comp10() {
45     1 > 2 == false; //~ ERROR comparison operators cannot be chained
46 }
47
48 fn comp11() {
49     1 == 2 == 3; //~ ERROR comparison operators cannot be chained
50     //~^ ERROR mismatched types
51 }
52
53 fn main() {}