about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-10-28 11:41:23 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-10-28 11:41:23 -0700
commitd491734b15692038b963fd1bfeaaf39be393b638 (patch)
tree8e1ce9b79907491d51fa62659c68949d2d06c351 /src/libsyntax/parse
parentea57134607b31733d507bc9289033064fa8b6cb5 (diff)
downloadrust-d491734b15692038b963fd1bfeaaf39be393b638.tar.gz
rust-d491734b15692038b963fd1bfeaaf39be393b638.zip
Point at `match` when a parse failure ocurrs inside of it
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 3056d1c545c..5ab0d8166b0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2474,7 +2474,11 @@ impl<'a> Parser<'a> {
                     return Ok(self.mk_expr(lo.to(hi), ex, attrs));
                 }
                 if self.eat_keyword(keywords::Match) {
-                    return self.parse_match_expr(attrs);
+                    let match_sp = self.prev_span;
+                    return self.parse_match_expr(attrs).map_err(|mut err| {
+                        err.span_label(match_sp, "while parsing this match expression");
+                        err
+                    });
                 }
                 if self.eat_keyword(keywords::Unsafe) {
                     return self.parse_block_expr(