summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs
blob: 23ea0ad61a7f7c8bb14252ae368f990bba2f3952 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-pass

// rust-lang/rust#55810: types for a binding in a match arm can be
// inferred from arms that come later in the match.

struct S;

impl S {
    fn method(&self) -> bool {
        unimplemented!()
    }
}

fn get<T>() -> T {
    unimplemented!()
}

fn main() {
    match get() {
        x if x.method() => {}
        &S => {}
    }
}