about summary refs log tree commit diff
path: root/src/test/ui/parser/require-parens-for-chained-comparison.rs
blob: e27b03dddc5be56882eaf84089585bd4ceb9e98d (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
fn f<T>() {}
struct X;

fn main() {
    false == false == false;
    //~^ ERROR comparison operators cannot be chained

    false == 0 < 2;
    //~^ ERROR comparison operators cannot be chained
    //~| ERROR mismatched types
    //~| ERROR mismatched types

    f<X>();
    //~^ ERROR comparison operators cannot be chained
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments

    f<Result<Option<X>, Option<Option<X>>>(1, 2);
    //~^ ERROR comparison operators cannot be chained
    //~| HELP split the comparison into two...
    //~| ...or parenthesize one of the comparisons
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments

    use std::convert::identity;
    let _ = identity<u8>;
    //~^ ERROR comparison operators cannot be chained
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments
    //~| HELP or use `(...)` if you meant to specify fn arguments
}