From 9d5c74e16ae4bca9efb0fbc5c4818200ea8b5980 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 2 Jul 2022 03:04:18 +0000 Subject: Do not suggest adding `;` when `,` is also a choice --- compiler/rustc_parse/src/parser/diagnostics.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 63055c56c5c..f9ca10375e6 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -560,7 +560,8 @@ impl<'a> Parser<'a> { || (sm.is_multiline( self.prev_token.span.shrink_to_hi().until(self.token.span.shrink_to_lo()) ) && t == &token::Pound) - }) { + }) && !expected.contains(&TokenType::Token(token::Comma)) + { // Missing semicolon typo. This is triggered if the next token could either start a // new statement or is a block close. For example: // -- cgit 1.4.1-3-g733a5