about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-01-01 19:14:00 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-01-01 23:59:32 +0300
commit3df500db29b6f50c5c74e7735a9e007ae90206d7 (patch)
tree5fd96ec9da7e57075dc8080d3874418134409a98 /src/libsyntax/parse
parentcae164753f557f668cb75610abda4f790981e5e6 (diff)
downloadrust-3df500db29b6f50c5c74e7735a9e007ae90206d7.tar.gz
rust-3df500db29b6f50c5c74e7735a9e007ae90206d7.zip
syntax: Fix regression in diagnostics for patterns in trait method parameters
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 52da8a072c7..a9d28362f57 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1866,7 +1866,8 @@ impl<'a> Parser<'a> {
             let parser_snapshot_before_ty = self.clone();
             self.eat_incorrect_doc_comment("a method argument's type");
             let mut ty = self.parse_ty();
-            if ty.is_ok() && self.token == token::Colon {
+            if ty.is_ok() && self.token != token::Comma &&
+               self.token != token::CloseDelim(token::Paren) {
                 // This wasn't actually a type, but a pattern looking like a type,
                 // so we are going to rollback and re-parse for recovery.
                 ty = self.unexpected();