Only record fallback_span
when necessary.
This commit is contained in:
parent
5b653c1a43
commit
9e6879fdba
1 changed files with 1 additions and 1 deletions
|
@ -1000,7 +1000,6 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// Advance the parser by one token.
|
/// Advance the parser by one token.
|
||||||
pub fn bump(&mut self) {
|
pub fn bump(&mut self) {
|
||||||
let fallback_span = self.token.span;
|
|
||||||
let (mut next, spacing) = self.token_cursor.inlined_next(self.desugar_doc_comments);
|
let (mut next, spacing) = self.token_cursor.inlined_next(self.desugar_doc_comments);
|
||||||
self.token_cursor.num_next_calls += 1;
|
self.token_cursor.num_next_calls += 1;
|
||||||
// We've retrieved an token from the underlying
|
// We've retrieved an token from the underlying
|
||||||
|
@ -1009,6 +1008,7 @@ impl<'a> Parser<'a> {
|
||||||
self.token_cursor.break_last_token = false;
|
self.token_cursor.break_last_token = false;
|
||||||
if next.span.is_dummy() {
|
if next.span.is_dummy() {
|
||||||
// Tweak the location for better diagnostics, but keep syntactic context intact.
|
// Tweak the location for better diagnostics, but keep syntactic context intact.
|
||||||
|
let fallback_span = self.token.span;
|
||||||
next.span = fallback_span.with_ctxt(next.span.ctxt());
|
next.span = fallback_span.with_ctxt(next.span.ctxt());
|
||||||
}
|
}
|
||||||
debug_assert!(!matches!(
|
debug_assert!(!matches!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue