1
Fork 0

Point at only one char on Span::next_point

Avoid pointing at two chars so the diagnostic output doesn't display a
multiline span when starting beyond a line end.
This commit is contained in:
Esteban Küber 2017-04-09 16:28:31 -07:00
parent d616f47cd0
commit 4c80170782
4 changed files with 28 additions and 3 deletions

View file

@ -592,8 +592,10 @@ impl<'a> Parser<'a> {
} else {
label_sp
};
err.span_label(sp, &label_exp);
if !sp.source_equal(&self.span) {
if self.span.contains(sp) {
err.span_label(self.span, &label_exp);
} else {
err.span_label(sp, &label_exp);
err.span_label(self.span, &"unexpected token");
}
Err(err)