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