]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | A struct's or struct-like enum variant's field was specified more than once. |
2 | ||
3 | Erroneous code example: | |
4 | ||
5 | ```compile_fail,E0062 | |
6 | struct Foo { | |
7 | x: i32, | |
8 | } | |
9 | ||
10 | fn main() { | |
11 | let x = Foo { | |
12 | x: 0, | |
13 | x: 0, // error: field `x` specified more than once | |
14 | }; | |
15 | } | |
16 | ``` | |
17 | ||
18 | This error indicates that during an attempt to build a struct or struct-like | |
19 | enum variant, one of the fields was specified more than once. Each field should | |
20 | be specified exactly one time. Example: | |
21 | ||
22 | ``` | |
23 | struct Foo { | |
24 | x: i32, | |
25 | } | |
26 | ||
27 | fn main() { | |
28 | let x = Foo { x: 0 }; // ok! | |
29 | } | |
30 | ``` |