From cbbc7becc820e05f64d8a23d1a63a27e51b8ff7a Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sat, 16 Nov 2024 00:10:48 +0000 Subject: Account for missing `.` in macros to avoid incorrect suggestion --- compiler/rustc_parse/src/parser/stmt.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 259bc3dcd36..30a150db728 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -763,6 +763,10 @@ impl<'a> Parser<'a> { } else { return; } + if self.token.span == self.prev_token.span { + // Account for syntax errors in proc-macros. + return; + } if self.look_ahead(1, |t| [token::Semi, token::Question, token::Dot].contains(&t.kind)) { err.span_suggestion_verbose( self.prev_token.span.between(self.token.span), -- cgit 1.4.1-3-g733a5