Fix the bug of next_point in span
This commit is contained in:
parent
11432fe952
commit
0af255a5aa
7 changed files with 13 additions and 13 deletions
|
@ -1461,7 +1461,7 @@ impl<'a> Parser<'a> {
|
|||
let (prev_sp, sp) = match (&self.token.kind, self.subparser_name) {
|
||||
// Point at the end of the macro call when reaching end of macro arguments.
|
||||
(token::Eof, Some(_)) => {
|
||||
let sp = self.sess.source_map().next_point(self.prev_token.span);
|
||||
let sp = self.prev_token.span.shrink_to_hi();
|
||||
(sp, sp)
|
||||
}
|
||||
// We don't want to point at the following span after DUMMY_SP.
|
||||
|
@ -2039,7 +2039,7 @@ impl<'a> Parser<'a> {
|
|||
pub(super) fn expected_expression_found(&self) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||
let (span, msg) = match (&self.token.kind, self.subparser_name) {
|
||||
(&token::Eof, Some(origin)) => {
|
||||
let sp = self.sess.source_map().next_point(self.prev_token.span);
|
||||
let sp = self.prev_token.span.shrink_to_hi();
|
||||
(sp, format!("expected expression, found end of {origin}"))
|
||||
}
|
||||
_ => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue