Skip to content

Commit d87f48d

Browse files
Add E0560 error explanation
1 parent a62394f commit d87f48d

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

4032+
E0560: r##"
4033+
An unknown field was specified into a structure.
4034+
4035+
Erroneous code example:
4036+
4037+
```compile_fail,E0560
4038+
struct Simba {
4039+
mother: u32,
4040+
}
4041+
4042+
let s = Simba { mother: 1, father: 0 };
4043+
// error: structure `Simba` has no field named `father`
4044+
```
4045+
4046+
Verify you didn't misspell the field's name or that the field exists. Example:
4047+
4048+
```
4049+
struct Simba {
4050+
mother: u32,
4051+
father: u32,
4052+
}
4053+
4054+
let s = Simba { mother: 1, father: 0 }; // ok!
4055+
```
4056+
"##,
4057+
40324058
}
40334059

40344060
register_diagnostics! {
@@ -4102,5 +4128,4 @@ register_diagnostics! {
41024128
E0529, // slice pattern expects array or slice, not `{}`
41034129
E0533, // `{}` does not name a unit variant, unit struct or a constant
41044130
E0559,
4105-
E0560,
41064131
}

0 commit comments

Comments
 (0)