Currently, we emit a "try adding a comma" suggestion if a comma is missing in a struct definition. However, we emit no such suggestion if a comma is missing in a struct initializer. This commit adds a "try adding a comma" suggestion when we don't find a comma during the parsing of a struct initializer field. The change to `src/test/ui/parser/removed-syntax-with-1.stderr` isn't great, but I don't see a good way of avoiding it.
13 lines
195 B
Rust
13 lines
195 B
Rust
struct Foo {
|
|
first: bool,
|
|
second: u8,
|
|
}
|
|
|
|
fn main() {
|
|
let a = Foo {
|
|
//~^ ERROR missing field
|
|
first: true
|
|
second: 25
|
|
//~^ ERROR expected one of
|
|
};
|
|
}
|