mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
f5d3b158b9
This prevents spurious errors when a field is intended to be present
but a preceding syntax error caused it not to be parsed. For example,
StructName { foo: 1 bar: 2 }
will not successfully parse a field `bar`, and we will report the syntax
error but not the missing field.
16 lines
502 B
Plaintext
16 lines
502 B
Plaintext
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `second`
|
|
--> $DIR/struct-initializer-comma.rs:11:9
|
|
|
|
|
LL | let _ = Foo {
|
|
| --- while parsing this struct
|
|
LL | first: true
|
|
| -
|
|
| |
|
|
| expected one of `,`, `.`, `?`, `}`, or an operator
|
|
| help: try adding a comma: `,`
|
|
LL | second: 25
|
|
| ^^^^^^ unexpected token
|
|
|
|
error: aborting due to 1 previous error
|
|
|