Closed
Description
I had a weird error message on the rust compiler when trying to compile something like this:
let Struct { name: "a".to_string() }
Here is a playground link that reproduces it better.
This gives out a weird expected ','
error, which wasn't at all what I was expecting. Certainly because of my sleepy state, but still weird.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
estebank commentedon Jul 6, 2020
Btw, the parser was expecting a comma because let doesn't just take identifiers, but patterns, which let's you write
let Struct { name, ..} = struct_val;
.Would the following have been enough to help you?
AZanellato commentedon Jul 6, 2020
I discovered this shortly thereafter! I think that would happen a ton. Maybe something along the lines of "Maybe you missed a name"?
But that would be awesome already 😄