about summary refs log tree commit diff
path: root/tests/ui/pattern/at-in-struct-patterns.rs
blob: b0557220d05a42f6d350542f5dd99a54d0a5a803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 `@`
}