about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-27 11:18:53 +0000
committerbors <bors@rust-lang.org>2020-05-27 11:18:53 +0000
commitacfc5584018de3a9a431a17f0cc34e0bfaf4cdeb (patch)
treebc831a62648379cfb43fba304bff233e2e4200f5 /src/librustc_parse/parser
parent783139bd8fc3b94fac9a1bf81bba2c506e8221b6 (diff)
parente6353aac9d0365d6541bb7f33548fdeb988b6563 (diff)
Auto merge of #72639 - Dylan-DPC:rollup-76upj51, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #72348 (Fix confusing error message for comma typo in multiline statement)
 - #72533 (Resolve UB in Arc/Weak interaction (2))
 - #72548 (Add test for old compiler ICE when using `Borrow`)
 - #72606 (Small cell example update)
 - #72610 (Remove font-display settings)
 - #72626 (Add remark regarding DoubleEndedIterator)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index f05d0186138..660a63841bc 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -935,6 +935,19 @@ impl<'a> Parser<'a> {
             return self.expect(&token::Semi).map(drop);
         } else if !sm.is_multiline(self.prev_token.span.until(self.token.span)) {
             // The current token is in the same line as the prior token, not recoverable.
+        } else if [token::Comma, token::Colon].contains(&self.token.kind)
+            && &self.prev_token.kind == &token::CloseDelim(token::Paren)
+        {
+            // Likely typo: The current token is on a new line and is expected to be
+            // `.`, `;`, `?`, or an operator after a close delimiter token.
+            //
+            // let a = std::process::Command::new("echo")
+            //         .arg("1")
+            //         ,arg("2")
+            //         ^
+            // https://github.com/rust-lang/rust/issues/72253
+            self.expect(&token::Semi)?;
+            return Ok(());
         } else if self.look_ahead(1, |t| {
             t == &token::CloseDelim(token::Brace) || t.can_begin_expr() && t.kind != token::Colon
         }) && [token::Comma, token::Colon].contains(&self.token.kind)