rust/tests/ui/pattern/issue-10392.rs
2024-02-16 20:02:50 +00:00

31 lines
465 B
Rust

//@ run-pass
#![allow(unused_variables)]
struct A { foo: isize }
struct B { a: isize, b: isize, c: isize }
fn mka() -> A { panic!() }
fn mkb() -> B { panic!() }
fn test() {
let A { foo, } = mka();
let A {
foo,
} = mka();
let B { a, b, c, } = mkb();
match mka() {
A { foo: _foo, } => {}
}
match Some(mka()) {
Some(A { foo: _foo, }) => {}
None => {}
}
}
pub fn main() {
if false { test() }
}