This is definitely a form which the compiler could recognize to provide a better error for. Please open a GitHub issue — there's a template and category specifically for error message quality that this would fit perfectly in
Definitely file bugs when you hit things like this.
Personally, I think that whenever there's an "expected one of" message without a help: message, it's a good bug, as a great place for a quick syntax reminder. Sketch:
error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:`
--> src/lib.rs:2:8
|
2 | vec: Vec<usize>,
| ^ expected one of `(`, `,`, `=`, `{`, or `}`
|
| help: enum variants are either `Variant(Type)` or `Variant { field: Type }`
I wonder if instead of these fairly opaque "error: expected <tokens>, found <token>" messages, the parser could print some representation of the full list of productions it is trying to match, something like:
error: expected one of
vec
vec = <integer>
vec(...)
vec { ... }
I guess finding a good balance between user-friendliness, terseness and precision would be tricky. Full EBNF would of course be the most precise, but verbose and possibly unfamiliar to many.