summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/missing-fat-arrow.rs
blob: 325f1ccf2fd9361f01ef164af83a197dc279746e (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
fn main() {
    let x = 1;
    let y = 2;
    let value = 3;

    match value {
        Some(x) if x == y {
            self.next_token()?; //~ ERROR expected identifier, found keyword `self`
        },
        _ => {}
    }
    let _: i32 = (); //~ ERROR mismatched types
}

struct Foo {
    value: usize
}

fn foo(a: Option<&mut Foo>, b: usize) {
    match a {
        Some(a) if a.value == b {
            a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.`
        },
        _ => {}
    }
    let _: i32 = (); //~ ERROR mismatched types
}

fn bar(a: Option<&mut Foo>, b: usize) {
    match a {
        Some(a) if a.value == b {
            a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.`
        } => {
        }
        _ => {}
    }
    let _: i32 = (); //~ ERROR mismatched types
}