Skip to content

Commit 9e6879f

Browse files
committed
Only record fallback_span when necessary.
1 parent 5b653c1 commit 9e6879f

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+1
-1
lines changed

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,6 @@ impl<'a> Parser<'a> {
10001000

10011001
/// Advance the parser by one token.
10021002
pub fn bump(&mut self) {
1003-
let fallback_span = self.token.span;
10041003
let (mut next, spacing) = self.token_cursor.inlined_next(self.desugar_doc_comments);
10051004
self.token_cursor.num_next_calls += 1;
10061005
// We've retrieved an token from the underlying
@@ -1009,6 +1008,7 @@ impl<'a> Parser<'a> {
10091008
self.token_cursor.break_last_token = false;
10101009
if next.span.is_dummy() {
10111010
// Tweak the location for better diagnostics, but keep syntactic context intact.
1011+
let fallback_span = self.token.span;
10121012
next.span = fallback_span.with_ctxt(next.span.ctxt());
10131013
}
10141014
debug_assert!(!matches!(

0 commit comments

Comments
 (0)