Skip to content

Commit 23bb1df

Browse files
GuillaumeGomezarielb1
authored andcommitted
Add E0559 error explanation
1 parent 0304850 commit 23bb1df

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/librustc_typeck/diagnostics.rs

+25-1
Original file line numberDiff line numberDiff line change
@@ -3980,6 +3980,31 @@ impl SpaceLlama for i32 {
39803980
```
39813981
"##,
39823982

3983+
E0559: r##"
3984+
An unknown field was specified into an enum's structure variant.
3985+
3986+
Erroneous code example:
3987+
3988+
```compile_fail,E0559
3989+
enum Field {
3990+
Fool { x: u32 },
3991+
}
3992+
3993+
let s = Field::Fool { joke: 0 };
3994+
// error: struct variant `Field::Fool` has no field named `joke`
3995+
```
3996+
3997+
Verify you didn't misspell the field's name or that the field exists. Example:
3998+
3999+
```
4000+
enum Field {
4001+
Fool { joke: u32 },
4002+
}
4003+
4004+
let s = Field::Fool { joke: 0 }; // ok!
4005+
```
4006+
"##,
4007+
39834008
E0560: r##"
39844009
An unknown field was specified into a structure.
39854010
@@ -4079,5 +4104,4 @@ register_diagnostics! {
40794104
E0528, // expected at least {} elements, found {}
40804105
E0529, // slice pattern expects array or slice, not `{}`
40814106
E0533, // `{}` does not name a unit variant, unit struct or a constant
4082-
E0559,
40834107
}

0 commit comments

Comments
 (0)