Skip to content

Commit 7ec4615

Browse files
Add E0559 error explanation
1 parent d87f48d commit 7ec4615

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
@@ -4029,6 +4029,31 @@ impl SpaceLlama for i32 {
40294029
```
40304030
"##,
40314031

4032+
E0559: r##"
4033+
An unknown field was specified into an enum's structure variant.
4034+
4035+
Erroneous code example:
4036+
4037+
```compile_fail,E0559
4038+
enum Field {
4039+
Fool { x: u32 },
4040+
}
4041+
4042+
let s = Field::Fool { joke: 0 };
4043+
// error: struct variant `Field::Fool` has no field named `joke`
4044+
```
4045+
4046+
Verify you didn't misspell the field's name or that the field exists. Example:
4047+
4048+
```
4049+
enum Field {
4050+
Fool { joke: u32 },
4051+
}
4052+
4053+
let s = Field::Fool { joke: 0 }; // ok!
4054+
```
4055+
"##,
4056+
40324057
E0560: r##"
40334058
An unknown field was specified into a structure.
40344059
@@ -4127,5 +4152,4 @@ register_diagnostics! {
41274152
E0528, // expected at least {} elements, found {}
41284153
E0529, // slice pattern expects array or slice, not `{}`
41294154
E0533, // `{}` does not name a unit variant, unit struct or a constant
4130-
E0559,
41314155
}

0 commit comments

Comments
 (0)