2020-07-24 20:14:10 -05:00
|
|
|
// check-pass
|
|
|
|
|
|
|
|
// Unlike `if` condition, `match` guards accept struct literals.
|
|
|
|
// This is detected in <https://github.com/rust-lang/rust/pull/74566#issuecomment-663613705>.
|
|
|
|
|
2023-08-28 04:31:45 -05:00
|
|
|
#![feature(if_let_guard)]
|
|
|
|
|
2020-07-24 20:14:10 -05:00
|
|
|
#[derive(PartialEq)]
|
|
|
|
struct Foo {
|
|
|
|
x: isize,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(f: Foo) {
|
|
|
|
match () {
|
|
|
|
() if f == Foo { x: 42 } => {}
|
2023-08-28 04:31:45 -05:00
|
|
|
() if let Foo { x: 0.. } = Foo { x: 42 } => {}
|
2020-07-24 20:14:10 -05:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|