about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-03-06 11:02:56 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-03-11 09:15:09 +1100
commit7a294e998b66ea6d410a6840cba80347fc4764c2 (patch)
treeaa7a68bfbbb9177a06cda144baca657f4939996b /compiler/rustc_lint
parenta09b1d33a703d4ed412e70d3197e73ba7e0937f9 (diff)
downloadrust-7a294e998b66ea6d410a6840cba80347fc4764c2.tar.gz
rust-7a294e998b66ea6d410a6840cba80347fc4764c2.zip
Rename `IntoDiagnostic` as `Diagnostic`.
To match `derive(Diagnostic)`.

Also rename `into_diagnostic` as `into_diag`.
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/messages.ftl2
-rw-r--r--compiler/rustc_lint/src/internal.rs11
2 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl
index 8bf9d0b9d4a..20b58032331 100644
--- a/compiler/rustc_lint/messages.ftl
+++ b/compiler/rustc_lint/messages.ftl
@@ -186,7 +186,7 @@ lint_deprecated_lint_name =
     .help = change it to {$replace}
 
 lint_diag_out_of_impl =
-    diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
+    diagnostics should only be created in `Diagnostic`/`AddToDiagnostic` impls
 
 lint_drop_glue =
     types that do not implement `Drop` can still have drop glue, consider instead using `{$needs_drop}` to detect whether a type is trivially dropped
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index e8fcf4132ea..bf5646b4651 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -351,7 +351,7 @@ declare_tool_lint! {
 
 declare_tool_lint! {
     /// The `diagnostic_outside_of_impl` lint detects calls to functions annotated with
-    /// `#[rustc_lint_diagnostics]` that are outside an `IntoDiagnostic`, `AddToDiagnostic`, or
+    /// `#[rustc_lint_diagnostics]` that are outside an `Diagnostic`, `AddToDiagnostic`, or
     /// `DecorateLint` impl, or a `#[derive(Diagnostic)]`, `#[derive(Subdiagnostic)]`,
     /// `#[derive(DecorateLint)]` expansion.
     ///
@@ -359,7 +359,7 @@ declare_tool_lint! {
     /// [here](https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html).
     pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL,
     Deny,
-    "prevent creation of diagnostics outside of `IntoDiagnostic`/`AddToDiagnostic` impls",
+    "prevent creation of diagnostics outside of `Diagnostic`/`AddToDiagnostic` impls",
     report_in_external_macro: true
 }
 
@@ -455,7 +455,7 @@ impl LateLintPass<'_> for Diagnostics {
         }
 
         // Calls to `#[rustc_lint_diagnostics]`-marked functions should only occur:
-        // - inside an impl of `IntoDiagnostic`, `AddToDiagnostic`, or `DecorateLint`, or
+        // - inside an impl of `Diagnostic`, `AddToDiagnostic`, or `DecorateLint`, or
         // - inside a parent function that is itself marked with `#[rustc_lint_diagnostics]`.
         //
         // Otherwise, emit a `DIAGNOSTIC_OUTSIDE_OF_IMPL` lint.
@@ -467,10 +467,7 @@ impl LateLintPass<'_> for Diagnostics {
                     && let Impl { of_trait: Some(of_trait), .. } = impl_
                     && let Some(def_id) = of_trait.trait_def_id()
                     && let Some(name) = cx.tcx.get_diagnostic_name(def_id)
-                    && matches!(
-                        name,
-                        sym::IntoDiagnostic | sym::AddToDiagnostic | sym::DecorateLint
-                    )
+                    && matches!(name, sym::Diagnostic | sym::AddToDiagnostic | sym::DecorateLint)
                 {
                     is_inside_appropriate_impl = true;
                     break;