diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-03-05 12:20:08 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-03-06 01:28:35 +0900 |
| commit | 47d91bc9e63260e528f44bf15009d1563a5197b8 (patch) | |
| tree | b22e1f562d15c3519eb46b520b8725566107d269 /compiler/rustc_parse/src/parser | |
| parent | 06460fe72c1ad9962c65f3b7326481a81979f465 (diff) | |
| download | rust-47d91bc9e63260e528f44bf15009d1563a5197b8.tar.gz rust-47d91bc9e63260e528f44bf15009d1563a5197b8.zip | |
suggest removing a semicolon after derive attributes
use current token span
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index ae46bfe3540..4f91f1fecba 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -449,6 +449,16 @@ impl<'a> Parser<'a> { if end.is_doc_comment() { err.span_label(end.span, "this doc comment doesn't document anything"); } + if end.meta_kind().is_some() { + if self.token.kind == TokenKind::Semi { + err.span_suggestion_verbose( + self.token.span, + "consider removing this semicolon", + String::new(), + Applicability::MaybeIncorrect, + ); + } + } if let [.., penultimate, _] = attrs { err.span_label(start.span.to(penultimate.span), "other attributes here"); } |
