-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.