Better error message for comma after base struct #41834 This adds a better error for commas after the base struct: ``` let foo = Foo { one: 111, ..Foo::default(), // This comma is a syntax error }; ``` The current error is a generic `expected one of ...` which isn't beginner-friendly. My error looks like this: ``` error: cannot use a comma after the base struct --> tmp/example.rs:26:9 | 26 | ..Foo::default(), | ^^^^^^^^^^^^^^^^- help: remove this comma | = note: the base struct expansion must always be the last field ``` I even added a note for people who don't know why this isn't allowed. |
||
|---|---|---|
| .. | ||
| diagnostics | ||
| ext | ||
| parse | ||
| util | ||
| abi.rs | ||
| ast.rs | ||
| attr.rs | ||
| build.rs | ||
| Cargo.toml | ||
| codemap.rs | ||
| config.rs | ||
| diagnostic_list.rs | ||
| entry.rs | ||
| feature_gate.rs | ||
| fold.rs | ||
| json.rs | ||
| lib.rs | ||
| ptr.rs | ||
| README.md | ||
| show_span.rs | ||
| std_inject.rs | ||
| str.rs | ||
| test.rs | ||
| test_snippet.rs | ||
| tokenstream.rs | ||
| visit.rs | ||
NB: This crate is part of the Rust compiler. For an overview of the
compiler as a whole, see
the README.md file found in librustc.
The syntax crate contains those things concerned purely with syntax
– that is, the AST ("abstract syntax tree"), parser, pretty-printer,
lexer, macro expander, and utilities for traversing ASTs.