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