From 47d91bc9e63260e528f44bf15009d1563a5197b8 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 5 Mar 2022 12:20:08 +0900 Subject: suggest removing a semicolon after derive attributes use current token span --- compiler/rustc_parse/src/parser/item.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/rustc_parse/src') 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"); } -- cgit 1.4.1-3-g733a5