about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-15 10:20:05 +0000
committerbors <bors@rust-lang.org>2020-02-15 10:20:05 +0000
commitdbef35309d10bed2f09cd55b3e9ea980a58c62aa (patch)
tree72b0aff59d492542867e747604c2abee64856211 /src/librustc_parse/parser
parent19288ddfd6b3448c2c221d75610bff722a6582e8 (diff)
parente9db0613acb2dfdb6a892873d59d0626b20c6cc8 (diff)
downloadrust-dbef35309d10bed2f09cd55b3e9ea980a58c62aa.tar.gz
rust-dbef35309d10bed2f09cd55b3e9ea980a58c62aa.zip
Auto merge of #69182 - Dylan-DPC:rollup-ifsa9fx, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #64069 (Added From<Vec<NonZeroU8>> for CString)
 - #66721 (implement LowerExp and UpperExp for integers)
 - #69106 (Fix std::fs::copy on WASI target)
 - #69154 (Avoid calling `fn_sig` on closures)
 - #69166 (Check `has_typeck_tables` before calling `typeck_tables_of`)
 - #69180 (Suggest a comma if a struct initializer field fails to parse)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/expr.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 5a4225ece65..20b9df0a2d9 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -1832,10 +1832,16 @@ impl<'a> Parser<'a> {
                     }
                 }
                 Err(mut e) => {
+                    e.span_label(struct_sp, "while parsing this struct");
                     if let Some(f) = recovery_field {
                         fields.push(f);
+                        e.span_suggestion(
+                            self.prev_span.shrink_to_hi(),
+                            "try adding a comma",
+                            ",".into(),
+                            Applicability::MachineApplicable,
+                        );
                     }
-                    e.span_label(struct_sp, "while parsing this struct");
                     e.emit();
                     self.recover_stmt_(SemiColonMode::Comma, BlockMode::Ignore);
                     self.eat(&token::Comma);