aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/syntax_error.rs
diff options
context:
space:
mode:
authorpcpthm <[email protected]>2019-03-21 17:22:06 +0000
committerpcpthm <[email protected]>2019-03-21 23:09:11 +0000
commit0acb61a911659537c51daf6793c67ef0c2b55bc9 (patch)
tree1eda85ba930c16ae378be638d392c4a624bd9429 /crates/ra_syntax/src/syntax_error.rs
parent4c7142d0c9be90c8947deb788993d903b2e0a5d1 (diff)
Fix an arithmetic overflow in reparser
Diffstat (limited to 'crates/ra_syntax/src/syntax_error.rs')
-rw-r--r--crates/ra_syntax/src/syntax_error.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/syntax_error.rs b/crates/ra_syntax/src/syntax_error.rs
index bdd431742..4b8c22a57 100644
--- a/crates/ra_syntax/src/syntax_error.rs
+++ b/crates/ra_syntax/src/syntax_error.rs
@@ -48,10 +48,10 @@ impl SyntaxError {
48 } 48 }
49 } 49 }
50 50
51 pub fn add_offset(mut self, plus_offset: TextUnit) -> SyntaxError { 51 pub fn add_offset(mut self, plus_offset: TextUnit, minus_offset: TextUnit) -> SyntaxError {
52 self.location = match self.location { 52 self.location = match self.location {
53 Location::Range(range) => Location::Range(range + plus_offset), 53 Location::Range(range) => Location::Range(range + plus_offset - minus_offset),
54 Location::Offset(offset) => Location::Offset(offset + plus_offset), 54 Location::Offset(offset) => Location::Offset(offset + plus_offset - minus_offset),
55 }; 55 };
56 56
57 self 57 self