about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-13 16:18:38 +0200
committerGitHub <noreply@github.com>2019-07-13 16:18:38 +0200
commit4fe6e63cd60ade52cd24616e17de5c570b06b0e7 (patch)
tree471a5bc275f28abb2c7c11b930774b9ab10eb7bd /src/libsyntax/parse
parent833dada10632814723426f07c53c9913dfec50c3 (diff)
parente1c7747cf06bc063a6586c1eab898703f61899d8 (diff)
downloadrust-4fe6e63cd60ade52cd24616e17de5c570b06b0e7.tar.gz
rust-4fe6e63cd60ade52cd24616e17de5c570b06b0e7.zip
Rollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix
Handle errors during error recovery gracefully

Fix #62546.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e0633f73ac4..83030e89af3 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -7410,10 +7410,13 @@ impl<'a> Parser<'a> {
             } else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) {
                 let ident = self.parse_ident().unwrap();
                 self.bump();  // `(`
-                let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs() {
-                    "method"
-                } else {
-                    "function"
+                let kw_name = match self.parse_self_arg_with_attrs() {
+                    Ok(Some(_)) => "method",
+                    Ok(None) => "function",
+                    Err(mut err) => {
+                        err.cancel();
+                        "function"
+                    }
                 };
                 self.consume_block(token::Paren);
                 let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) {