aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_syntax/src/parser_impl/event.rs7
-rw-r--r--crates/ra_syntax/src/yellow/syntax_error.rs7
2 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parser_impl/event.rs
index 1445401bc..bf9c1cef0 100644
--- a/crates/ra_syntax/src/parser_impl/event.rs
+++ b/crates/ra_syntax/src/parser_impl/event.rs
@@ -162,9 +162,10 @@ impl<'a, S: Sink> EventProcessor<'a, S> {
162 .sum::<TextUnit>(); 162 .sum::<TextUnit>();
163 self.leaf(kind, len, n_raw_tokens); 163 self.leaf(kind, len, n_raw_tokens);
164 } 164 }
165 Event::Error { msg } => self.sink.error( 165 Event::Error { msg } => self.sink.error(SyntaxError::new(
166 SyntaxError::new(SyntaxErrorKind::ParseError(msg), self.text_pos), 166 SyntaxErrorKind::ParseError(msg),
167 ), 167 self.text_pos,
168 )),
168 } 169 }
169 } 170 }
170 self.sink 171 self.sink
diff --git a/crates/ra_syntax/src/yellow/syntax_error.rs b/crates/ra_syntax/src/yellow/syntax_error.rs
index 098366f85..f3df6bc15 100644
--- a/crates/ra_syntax/src/yellow/syntax_error.rs
+++ b/crates/ra_syntax/src/yellow/syntax_error.rs
@@ -28,7 +28,10 @@ impl Into<Location> for TextRange {
28 28
29impl SyntaxError { 29impl SyntaxError {
30 pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError { 30 pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError {
31 SyntaxError { kind, location: loc.into() } 31 SyntaxError {
32 kind,
33 location: loc.into(),
34 }
32 } 35 }
33 36
34 pub fn location(&self) -> Location { 37 pub fn location(&self) -> Location {
@@ -45,7 +48,7 @@ impl SyntaxError {
45 pub fn add_offset(mut self, plus_offset: TextUnit) -> SyntaxError { 48 pub fn add_offset(mut self, plus_offset: TextUnit) -> SyntaxError {
46 self.location = match self.location { 49 self.location = match self.location {
47 Location::Range(range) => Location::Range(range + plus_offset), 50 Location::Range(range) => Location::Range(range + plus_offset),
48 Location::Offset(offset) => Location::Offset(offset + plus_offset) 51 Location::Offset(offset) => Location::Offset(offset + plus_offset),
49 }; 52 };
50 53
51 self 54 self