1
Fork 0

Fix the bug of next_point in span

This commit is contained in:
yukang 2022-10-18 02:00:06 +08:00
parent 11432fe952
commit 0af255a5aa
7 changed files with 13 additions and 13 deletions

View file

@ -937,13 +937,12 @@ pub fn ensure_complete_parse<'a>(
kind_name,
);
err.note(&msg);
let semi_span = this.sess.source_map().next_point(span);
let semi_full_span = semi_span.to(this.sess.source_map().next_point(semi_span));
match this.sess.source_map().span_to_snippet(semi_full_span) {
let semi_span = this.sess.source_map().next_point(span);
match this.sess.source_map().span_to_snippet(semi_span) {
Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => {
err.span_suggestion(
semi_span,
span.shrink_to_hi(),
"you might be missing a semicolon here",
";",
Applicability::MaybeIncorrect,

View file

@ -82,7 +82,7 @@ fn emit_frag_parse_err(
);
if !e.span.is_dummy() {
// early end of macro arm (#52866)
e.replace_span_with(parser.sess.source_map().next_point(parser.token.span));
e.replace_span_with(parser.token.span.shrink_to_hi());
}
}
if e.span.is_dummy() {