diff options
| author | Maerten <39694331+lambtowolf@users.noreply.github.com> | 2018-05-30 09:16:18 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2018-06-22 11:38:38 +0200 |
| commit | fadb86f25d4053289c612cbba6b92da793976c16 (patch) | |
| tree | ce60a6d78a8550bab0251095e1620ac93e79af06 /src/libsyntax/parse/parser.rs | |
| parent | 6c962e3ec413cb1cdb686c40609d4a1312f75e3d (diff) | |
| download | rust-fadb86f25d4053289c612cbba6b92da793976c16.tar.gz rust-fadb86f25d4053289c612cbba6b92da793976c16.zip | |
Fix when the help message is displayed
Only display the "remove this comma" suggestion when followed by an identifier
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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 @@ impl<'a> Parser<'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 |
