mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
19 lines
335 B
Rust
19 lines
335 B
Rust
// 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() {}
|