about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/errors.rs
diff options
context:
space:
mode:
authorRejyr <jerrylwang123@gmail.com>2022-08-19 17:17:14 -0400
committerRejyr <jerrylwang123@gmail.com>2022-08-22 08:24:14 -0400
commit874a79fae30ec93bcd9847187741378c405bd9da (patch)
tree8baa6b2f3a93d03c468281cc11417a141e4b72f8 /compiler/rustc_lint/src/errors.rs
parentd197c1eb5bee2d4c2c27c895f5e496df935ccbd0 (diff)
downloadrust-874a79fae30ec93bcd9847187741378c405bd9da.tar.gz
rust-874a79fae30ec93bcd9847187741378c405bd9da.zip
migrate: `bad_attr` to `SessionDiagnostic`
Diffstat (limited to 'compiler/rustc_lint/src/errors.rs')
-rw-r--r--compiler/rustc_lint/src/errors.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 3f4d856a1cc..679cfad4961 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -1,7 +1,26 @@
-use rustc_macros::SessionDiagnostic;
+use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
 use rustc_span::Span;
 
 #[derive(SessionDiagnostic)]
+#[error(lint::malformed_attribute, code = "E0452")]
+pub struct MalformedAttribute {
+    #[primary_span]
+    pub span: Span,
+    #[subdiagnostic]
+    pub sub: MalformedAttributeSub,
+}
+
+#[derive(SessionSubdiagnostic)]
+pub enum MalformedAttributeSub {
+    #[label(lint::bad_attribute_argument)]
+    BadAttributeArgument(#[primary_span] Span),
+    #[label(lint::reason_must_be_string_literal)]
+    ReasonMustBeStringLiteral(#[primary_span] Span),
+    #[label(lint::reason_must_come_last)]
+    ReasonMustComeLast(#[primary_span] Span),
+}
+
+#[derive(SessionDiagnostic)]
 #[error(lint::unknown_tool, code = "E0710")]
 pub struct UnknownTool {
     #[primary_span]