summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/compatible-variants-in-pat.rs
blob: 09e12dab2d3fc6533f48419777c03aa47333974b (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
enum Foo {
    Bar(Bar),
}
struct Bar {
    x: i32,
}

fn a(f: Foo) {
    match f {
        Bar { x } => {
            //~^ ERROR mismatched types
            //~| HELP try wrapping
        }
    }
}

struct S;

fn b(s: Option<S>) {
    match s {
        S => {
            //~^ ERROR mismatched types
            //~| HELP try wrapping
            //~| HELP introduce a new binding instead
        }
        _ => {}
    }
}

fn c(s: Result<S, S>) {
    match s {
        S => {
            //~^ ERROR mismatched types
            //~| HELP try wrapping
            //~| HELP introduce a new binding instead
        }
        _ => {}
    }
}

fn main() {}