about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-23 09:06:39 +0000
committerbors <bors@rust-lang.org>2022-10-23 09:06:39 +0000
commite64f1110c062f61746f222059439529a43ccf6dc (patch)
treef6deb949a3796b6fd79eef0a3745e2d9dcc1ae8c /compiler/rustc_lint/src/errors.rs
parentfaab68eb29121f25b577b50e2e00e33bafc60a36 (diff)
parent6987322445d7388b61d6249204402574ee0308f5 (diff)
downloadrust-e64f1110c062f61746f222059439529a43ccf6dc.tar.gz
rust-e64f1110c062f61746f222059439529a43ccf6dc.zip
Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errors
Flatten diagnostic slug modules

This makes it easier to grep for the slugs in the code.

See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it.

This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know.

r? `@davidtwco`
Diffstat (limited to 'compiler/rustc_lint/src/errors.rs')
-rw-r--r--compiler/rustc_lint/src/errors.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 34b70030a58..a49d1bdacc2 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -7,7 +7,7 @@ use rustc_session::lint::Level;
 use rustc_span::{Span, Symbol};
 
 #[derive(Diagnostic)]
-#[diag(lint::overruled_attribute, code = "E0453")]
+#[diag(lint_overruled_attribute, code = "E0453")]
 pub struct OverruledAttribute {
     #[primary_span]
     pub span: Span,
@@ -32,24 +32,24 @@ impl AddToDiagnostic for OverruledAttributeSub {
     {
         match self {
             OverruledAttributeSub::DefaultSource { id } => {
-                diag.note(fluent::lint::default_source);
+                diag.note(fluent::lint_default_source);
                 diag.set_arg("id", id);
             }
             OverruledAttributeSub::NodeSource { span, reason } => {
-                diag.span_label(span, fluent::lint::node_source);
+                diag.span_label(span, fluent::lint_node_source);
                 if let Some(rationale) = reason {
                     diag.note(rationale.as_str());
                 }
             }
             OverruledAttributeSub::CommandLineSource => {
-                diag.note(fluent::lint::command_line_source);
+                diag.note(fluent::lint_command_line_source);
             }
         }
     }
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::malformed_attribute, code = "E0452")]
+#[diag(lint_malformed_attribute, code = "E0452")]
 pub struct MalformedAttribute {
     #[primary_span]
     pub span: Span,
@@ -59,16 +59,16 @@ pub struct MalformedAttribute {
 
 #[derive(Subdiagnostic)]
 pub enum MalformedAttributeSub {
-    #[label(lint::bad_attribute_argument)]
+    #[label(lint_bad_attribute_argument)]
     BadAttributeArgument(#[primary_span] Span),
-    #[label(lint::reason_must_be_string_literal)]
+    #[label(lint_reason_must_be_string_literal)]
     ReasonMustBeStringLiteral(#[primary_span] Span),
-    #[label(lint::reason_must_come_last)]
+    #[label(lint_reason_must_come_last)]
     ReasonMustComeLast(#[primary_span] Span),
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::unknown_tool_in_scoped_lint, code = "E0710")]
+#[diag(lint_unknown_tool_in_scoped_lint, code = "E0710")]
 pub struct UnknownToolInScopedLint {
     #[primary_span]
     pub span: Option<Span>,
@@ -79,7 +79,7 @@ pub struct UnknownToolInScopedLint {
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::builtin_ellipsis_inclusive_range_patterns, code = "E0783")]
+#[diag(lint_builtin_ellipsis_inclusive_range_patterns, code = "E0783")]
 pub struct BuiltinEllpisisInclusiveRangePatterns {
     #[primary_span]
     pub span: Span,
@@ -89,14 +89,14 @@ pub struct BuiltinEllpisisInclusiveRangePatterns {
 }
 
 #[derive(Subdiagnostic)]
-#[note(lint::requested_level)]
+#[note(lint_requested_level)]
 pub struct RequestedLevel {
     pub level: Level,
     pub lint_name: String,
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::unsupported_group, code = "E0602")]
+#[diag(lint_unsupported_group, code = "E0602")]
 pub struct UnsupportedGroup {
     pub lint_group: String,
 }
@@ -112,10 +112,10 @@ impl IntoDiagnostic<'_> for CheckNameUnknown {
         self,
         handler: &Handler,
     ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
-        let mut diag = handler.struct_err(fluent::lint::check_name_unknown);
+        let mut diag = handler.struct_err(fluent::lint_check_name_unknown);
         diag.code(rustc_errors::error_code!(E0602));
         if let Some(suggestion) = self.suggestion {
-            diag.help(fluent::lint::help);
+            diag.help(fluent::help);
             diag.set_arg("suggestion", suggestion);
         }
         diag.set_arg("lint_name", self.lint_name);
@@ -125,7 +125,7 @@ impl IntoDiagnostic<'_> for CheckNameUnknown {
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::check_name_unknown_tool, code = "E0602")]
+#[diag(lint_check_name_unknown_tool, code = "E0602")]
 pub struct CheckNameUnknownTool {
     pub tool_name: Symbol,
     #[subdiagnostic]
@@ -133,7 +133,7 @@ pub struct CheckNameUnknownTool {
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::check_name_warning)]
+#[diag(lint_check_name_warning)]
 pub struct CheckNameWarning {
     pub msg: String,
     #[subdiagnostic]
@@ -141,7 +141,7 @@ pub struct CheckNameWarning {
 }
 
 #[derive(Diagnostic)]
-#[diag(lint::check_name_deprecated)]
+#[diag(lint_check_name_deprecated)]
 pub struct CheckNameDeprecated {
     pub lint_name: String,
     pub new_name: String,