Fix ICE when pointing at multi bytes character

This commit is contained in:
Yuki Okushi 2020-12-19 19:29:56 +09:00
parent d107a87d34
commit 4ae99cc843
6 changed files with 66 additions and 21 deletions

View file

@ -721,13 +721,9 @@ impl<'a> Parser<'a> {
Ok(t) => {
// Parsed successfully, therefore most probably the code only
// misses a separator.
let mut exp_span = self.sess.source_map().next_point(sp);
if self.sess.source_map().is_multiline(exp_span) {
exp_span = sp;
}
expect_err
.span_suggestion_short(
exp_span,
sp,
&format!("missing `{}`", token_str),
token_str,
Applicability::MaybeIncorrect,