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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user