Closed
Description
I changed an enum to a struct but forgot to change the enum
keyword to a struct
keyword, it took me a while to realize what the problem was because the error is unclear.
enum
used where code looks like a struct
pub enum NotEnum {
field: u8
}
The error is
error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:`
--> src/lib.rs:2:10
|
2 | field: u8,
| ^ expected one of `(`, `,`, `=`, `{`, or `}`
error: expected item, found `:`
--> src/lib.rs:2:10
|
2 | field: u8,
| ^ expected item
A suggestion saying help: change `enum` to `struct`
would be useful.
struct
used where code looks like an enum
pub struct NotStruct {
Variant
}
error: expected `:`, found `}`
--> src/lib.rs:3:1
|
2 | Variant
| - expected `:`
3 | }
| ^ unexpected token
A suggestion saying help: change `struct` to `enum`
would be useful.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.