about summary refs log tree commit diff
path: root/tests/ui/parser/recover/recover-pat-lets.rs
blob: 6681cc25db37b826e4f4e732fcf780ef534dbd8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn main() {
    let x = Some(2);

    let x.expect("foo");
    //~^ error: expected a pattern, found an expression

    let x.unwrap(): u32;
    //~^ error: expected a pattern, found an expression

    let x[0] = 1;
    //~^ error: expected a pattern, found an expression

    let Some(1 + 1) = x else { //~ error: expected a pattern, found an expression
        return;
    };

    if let Some(1 + 1) = x { //~ error: expected a pattern, found an expression
        return;
    }
}