mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
15 lines
568 B
Rust
15 lines
568 B
Rust
struct Foo {
|
|
field1: u8,
|
|
field2: u8,
|
|
}
|
|
|
|
fn main() {
|
|
let foo = Foo { field1: 1, field2: 2 };
|
|
let Foo { var @ field1, .. } = foo; //~ ERROR Unexpected `@` in struct pattern
|
|
dbg!(var); //~ ERROR cannot find value `var` in this scope
|
|
let Foo { field1: _, bar @ .. } = foo; //~ ERROR `@ ..` is not supported in struct patterns
|
|
let Foo { bar @ .. } = foo; //~ ERROR `@ ..` is not supported in struct patterns
|
|
let Foo { @ } = foo; //~ ERROR expected identifier, found `@`
|
|
let Foo { @ .. } = foo; //~ ERROR expected identifier, found `@`
|
|
}
|