about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-13 17:11:36 +0000
committerbors <bors@rust-lang.org>2019-07-13 17:11:36 +0000
commit69656fa4cbafc378fd63f9186d93b0df3cdd9320 (patch)
tree690b6c3c570374a457a346b7462c8c7c9061d6c3 /src/libsyntax/parse
parentec30876f30082a7b32876bd78a8da01f11dcde1e (diff)
parent791ceb6a9c5dfeeeb5fc6098db2022a99c2eec18 (diff)
downloadrust-69656fa4cbafc378fd63f9186d93b0df3cdd9320.tar.gz
rust-69656fa4cbafc378fd63f9186d93b0df3cdd9320.zip
Auto merge of #62659 - Centril:rollup-90oz643, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #62577 (Add an AtomicCell abstraction)
 - #62585 (Make struct_tail normalize when possible)
 - #62604 (Handle errors during error recovery gracefully)
 - #62636 (rustbuild: Improve assert about building tools once)
 - #62651 (Make some rustc macros more hygienic)

Failed merges:

r? @ghost
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) {