diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1ed902e8861..d6916c1c344 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -776,8 +776,8 @@ fn expected_ident_found(&self) -> DiagnosticBuilder<'a> { err.span_label(self.span, format!("expected identifier, found {}", token_descr)); } else { err.span_label(self.span, "expected identifier"); - if self.token == token::Comma { - err.span_suggestion(self.span, "remove this comma", ",".into()); + if self.token == token::Comma && self.look_ahead(1, |t| *t.is_ident()) { + err.span_suggestion(self.span, "remove this comma", "".into()); } } err