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:
parent
d616f47cd0
commit
4c80170782
4 changed files with 28 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue