diff options
| author | Alex Burka <alex@alexburka.com> | 2017-06-24 18:26:04 +0000 |
|---|---|---|
| committer | Alex Burka <alex@alexburka.com> | 2017-06-27 18:39:38 +0000 |
| commit | 0dfd9c30f2c61458343e0816c66f448019e826d1 (patch) | |
| tree | c372f56ca32275416f35ef2a76561c9086752334 /src/libsyntax/parse | |
| parent | 229d0d3266002d343cdd2f4a3bf7f2fe9da15f38 (diff) | |
| download | rust-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.rs | 4 |
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; |
