rust/tests/ui/pattern/struct-field-duplicate-binding-15260.rs
2025-08-09 16:27:20 +05:00

28 lines
578 B
Rust

//! Regression test for https://github.com/rust-lang/rust/issues/15260
struct Foo {
a: usize,
}
fn main() {
let Foo {
a: _,
a: _
//~^ ERROR field `a` bound multiple times in the pattern
} = Foo { a: 29 };
let Foo {
a,
a: _
//~^ ERROR field `a` bound multiple times in the pattern
} = Foo { a: 29 };
let Foo {
a,
a: _,
//~^ ERROR field `a` bound multiple times in the pattern
a: x
//~^ ERROR field `a` bound multiple times in the pattern
} = Foo { a: 29 };
}