about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2022-02-17 16:30:48 -0800
committerNoah Lev <camelidcamel@gmail.com>2022-03-23 22:31:57 -0700
commit4212835d993537158aa39406a489351a4efdda71 (patch)
tree25ba3362dae10825466043e4a5fd719eb27f3fca /compiler/rustc_parse/src
parent29a5c363c7af619c1264c8b1e80241e503b27b47 (diff)
downloadrust-4212835d993537158aa39406a489351a4efdda71.tar.gz
rust-4212835d993537158aa39406a489351a4efdda71.zip
Add heuristic to avoid treating `x + +2` as increment
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 8ac29c2b5f6..8c4ec8dc6e3 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -269,6 +269,7 @@ impl<'a> Parser<'a> {
 
             if self.prev_token == token::BinOp(token::Plus)
                 && self.token == token::BinOp(token::Plus)
+                && self.prev_token.span.between(self.token.span).is_empty()
             {
                 let op_span = self.prev_token.span.to(self.token.span);
                 // Eat the second `+`