]> git.proxmox.com Git - rustc.git/blame - src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / destructuring-assignment / struct_destructure_fail.stderr
CommitLineData
fc512014
XL
1error: expected identifier, found reserved identifier `_`
2 --> $DIR/struct_destructure_fail.rs:12:17
3 |
4LL | Struct { a, _ } = Struct { a: 1, b: 2 };
5 | ------ ^ expected identifier, found reserved identifier
6 | |
7 | while parsing this struct
8
29967ef6 9error: functional record updates are not allowed in destructuring assignments
fc512014 10 --> $DIR/struct_destructure_fail.rs:14:19
29967ef6
XL
11 |
12LL | Struct { a, ..d } = Struct { a: 1, b: 2 };
13 | ^ help: consider removing the trailing pattern
14
15error: base expression required after `..`
fc512014 16 --> $DIR/struct_destructure_fail.rs:16:19
29967ef6
XL
17 |
18LL | Struct { a, .. };
19 | ^ add a base expression here
20
21error[E0026]: struct `Struct` does not have a field named `c`
22 --> $DIR/struct_destructure_fail.rs:11:20
23 |
24LL | Struct { a, b, c } = Struct { a: 0, b: 1 };
25 | ^ struct `Struct` does not have this field
26
fc512014
XL
27error[E0027]: pattern does not mention field `b`
28 --> $DIR/struct_destructure_fail.rs:12:5
29 |
30LL | Struct { a, _ } = Struct { a: 1, b: 2 };
31 | ^^^^^^^^^^^^^^^ missing field `b`
32 |
33help: include the missing field in the pattern
34 |
5869c6ff
XL
35LL | Struct { a, b } = Struct { a: 1, b: 2 };
36 | ^^^^^
fc512014
XL
37help: if you don't care about this missing field, you can explicitly ignore it
38 |
5869c6ff
XL
39LL | Struct { a, .. } = Struct { a: 1, b: 2 };
40 | ^^^^^^
fc512014
XL
41
42error: aborting due to 5 previous errors
29967ef6 43
fc512014
XL
44Some errors have detailed explanations: E0026, E0027.
45For more information about an error, try `rustc --explain E0026`.