Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
9491f18c5de3ff1c4bf9c3fdacf52d9859e26f7c
rust/src/test/ui/suggestions/struct-initializer-comma.rs

14 lines
195 B
Rust
Raw Normal View History

Suggest a comma if a struct initializer field fails to parse 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.
2020-02-14 22:28:13 -05:00
struct Foo {
first: bool,
second: u8,
}
fn main() {
let a = Foo {
//~^ ERROR missing field
first: true
second: 25
//~^ ERROR expected one of
};
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 2229ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API