]> git.proxmox.com Git - rustc.git/blob - tests/ui/parser/require-parens-for-chained-comparison.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / parser / require-parens-for-chained-comparison.rs
1 fn main() {
2 false == false == false;
3 //~^ ERROR comparison operators cannot be chained
4 //~| HELP split the comparison into two
5
6 false == 0 < 2;
7 //~^ ERROR comparison operators cannot be chained
8 //~| HELP parenthesize the comparison
9
10 f<X>();
11 //~^ ERROR comparison operators cannot be chained
12 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
13
14 f<Result<Option<X>, Option<Option<X>>>(1, 2);
15 //~^ ERROR comparison operators cannot be chained
16 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
17
18 let _ = f<u8, i8>();
19 //~^ ERROR expected one of
20 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
21
22 let _ = f<'_, i8>();
23 //~^ ERROR expected one of
24 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
25 //~| ERROR expected
26 //~| HELP add `'` to close the char literal
27
28 f<'_>();
29 //~^ comparison operators cannot be chained
30 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
31 //~| ERROR expected
32 //~| HELP add `'` to close the char literal
33
34 let _ = f<u8>;
35 //~^ ERROR comparison operators cannot be chained
36 //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
37 //~| HELP or use `(...)` if you meant to specify fn arguments
38 }