Skip to content

Commit 0304850

Browse files
GuillaumeGomezarielb1
authored andcommitted
Add E0560 error explanation
1 parent e76a46a commit 0304850

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/librustc_typeck/diagnostics.rs

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

3983+
E0560: r##"
3984+
An unknown field was specified into a structure.
3985+
3986+
Erroneous code example:
3987+
3988+
```compile_fail,E0560
3989+
struct Simba {
3990+
mother: u32,
3991+
}
3992+
3993+
let s = Simba { mother: 1, father: 0 };
3994+
// error: structure `Simba` has no field named `father`
3995+
```
3996+
3997+
Verify you didn't misspell the field's name or that the field exists. Example:
3998+
3999+
```
4000+
struct Simba {
4001+
mother: u32,
4002+
father: u32,
4003+
}
4004+
4005+
let s = Simba { mother: 1, father: 0 }; // ok!
4006+
```
4007+
"##,
4008+
39834009
}
39844010

39854011
register_diagnostics! {
@@ -4054,5 +4080,4 @@ register_diagnostics! {
40544080
E0529, // slice pattern expects array or slice, not `{}`
40554081
E0533, // `{}` does not name a unit variant, unit struct or a constant
40564082
E0559,
4057-
E0560,
40584083
}

0 commit comments

Comments
 (0)