summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/struct-literal-in-match-guard.rs
blob: bf0551b5c97b09bff7f6623a03cf52a40df022c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// check-pass

// Unlike `if` condition, `match` guards accept struct literals.
// This is detected in <https://github.com/rust-lang/rust/pull/74566#issuecomment-663613705>.

#[derive(PartialEq)]
struct Foo {
    x: isize,
}

fn foo(f: Foo) {
    match () {
        () if f == Foo { x: 42 } => {}
        _ => {}
    }
}

fn main() {}