about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2017-06-29 08:40:05 +0000
committerGitHub <noreply@github.com>2017-06-29 08:40:05 +0000
commiteffd1e040ea34c02892209caf0b46d535d4940e8 (patch)
tree4740f7cf4f21f712cb902e27360a64615556b968 /src/libsyntax
parent4bae0d8b7fef1a5eb1027dcdc6a7b322b0dbc29c (diff)
parent0dfd9c30f2c61458343e0816c66f448019e826d1 (diff)
downloadrust-effd1e040ea34c02892209caf0b46d535d4940e8.tar.gz
rust-effd1e040ea34c02892209caf0b46d535d4940e8.zip
Rollup merge of #42886 - durka:pplmm-mwe, r=petrochenkov
syntax: allow negative integer literal expression to be interpolated as pattern

Fixes #42820.

r? @jseyfried
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 851a638e148..5b0031b2f17 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1659,8 +1659,10 @@ impl<'a> Parser<'a> {
         Ok(codemap::Spanned { node: lit, span: lo.to(self.prev_span) })
     }
 
-    /// matches '-' lit | lit
+    /// matches '-' lit | lit (cf. ast_validation::AstValidator::check_expr_within_pat)
     pub fn parse_pat_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>> {
+        maybe_whole_expr!(self);
+
         let minus_lo = self.span;
         let minus_present = self.eat(&token::BinOp(token::Minus));
         let lo = self.span;