rust/tests/ui/pattern/issue-10392.rs
2023-01-11 09:32:08 +00:00

31 lines
464 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() }
}