diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-20 14:04:22 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-20 14:04:22 +1000 |
| commit | 9e6879fdba34e5f5b2657b6666f00f6091b89545 (patch) | |
| tree | 2f593cc6f402fe000e4a3ea3feec3abf07472a1f /compiler/rustc_parse/src/parser | |
| parent | 5b653c1a43b88d39a127b4b24dac327080151268 (diff) | |
| download | rust-9e6879fdba34e5f5b2657b6666f00f6091b89545.tar.gz rust-9e6879fdba34e5f5b2657b6666f00f6091b89545.zip | |
Only record `fallback_span` when necessary.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 173e0c2d529..28be9f4b592 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1000,7 +1000,6 @@ impl<'a> Parser<'a> { /// Advance the parser by one token. pub fn bump(&mut self) { - let fallback_span = self.token.span; let (mut next, spacing) = self.token_cursor.inlined_next(self.desugar_doc_comments); self.token_cursor.num_next_calls += 1; // We've retrieved an token from the underlying @@ -1009,6 +1008,7 @@ impl<'a> Parser<'a> { self.token_cursor.break_last_token = false; if next.span.is_dummy() { // 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()); } debug_assert!(!matches!( |
