]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0559.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0559.md
1 An unknown field was specified into an enum's structure variant.
2
3 Erroneous code example:
4
5 ```compile_fail,E0559
6 enum Field {
7     Fool { x: u32 },
8 }
9
10 let s = Field::Fool { joke: 0 };
11 // error: struct variant `Field::Fool` has no field named `joke`
12 ```
13
14 Verify you didn't misspell the field's name or that the field exists. Example:
15
16 ```
17 enum Field {
18     Fool { joke: u32 },
19 }
20
21 let s = Field::Fool { joke: 0 }; // ok!
22 ```