about summary refs log tree commit diff
path: root/compiler/rustc_parse
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-04 22:24:59 +0200
committerGitHub <noreply@github.com>2022-08-04 22:24:59 +0200
commitf6ea143f939934e2c3a6068feff4bd066cc19ff4 (patch)
treea040cd4dae8a569d2cf143e438917749ea1319b8 /compiler/rustc_parse
parent3830ecaa8db798d2727cbdfa4ddf314ff938f268 (diff)
parent9d5c74e16ae4bca9efb0fbc5c4818200ea8b5980 (diff)
downloadrust-f6ea143f939934e2c3a6068feff4bd066cc19ff4.tar.gz
rust-f6ea143f939934e2c3a6068feff4bd066cc19ff4.zip
Rollup merge of #98796 - compiler-errors:no-semi-if-comma, r=estebank
Do not exclusively suggest `;` when `,` is also a choice

Fixes #96791
Diffstat (limited to 'compiler/rustc_parse')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 09329f18c67..a2155ac1d1a 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:
                 //