mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Err for comma after functional update syntax
This commit is contained in:
parent
c7c582afb5
commit
2fd19ed598
3 changed files with 81 additions and 0 deletions
|
@ -693,6 +693,17 @@ pub(crate) fn record_expr_field_list(p: &mut Parser<'_>) {
|
|||
// We permit `.. }` on the left-hand side of a destructuring assignment.
|
||||
if !p.at(T!['}']) {
|
||||
expr(p);
|
||||
|
||||
if p.at(T![,]) {
|
||||
// test_err comma_after_functional_update_syntax
|
||||
// fn foo() {
|
||||
// S { ..x, };
|
||||
// S { ..x, a: 0 }
|
||||
// }
|
||||
|
||||
// Do not bump, so we can support additional fields after this comma.
|
||||
p.error("cannot use a comma after the base struct");
|
||||
}
|
||||
}
|
||||
}
|
||||
T!['{'] => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue