about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorAlex Burka <alex@alexburka.com>2017-06-24 18:26:04 +0000
committerAlex Burka <alex@alexburka.com>2017-06-27 18:39:38 +0000
commit0dfd9c30f2c61458343e0816c66f448019e826d1 (patch)
treec372f56ca32275416f35ef2a76561c9086752334 /src/libsyntax/parse
parent229d0d3266002d343cdd2f4a3bf7f2fe9da15f38 (diff)
downloadrust-0dfd9c30f2c61458343e0816c66f448019e826d1.tar.gz
rust-0dfd9c30f2c61458343e0816c66f448019e826d1.zip
syntax: allow negative integer literal expression to be interpolated as pattern
Diffstat (limited to 'src/libsyntax/parse')
-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;