diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-06 14:00:16 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-11 10:04:49 +1100 |
| commit | 541d7cc65c56402f31335e41075838c0da5fbe01 (patch) | |
| tree | 4dcf1c44019f4bb235268ec7f45b38cc15617c43 /compiler/rustc_lint/src/internal.rs | |
| parent | 7a294e998b66ea6d410a6840cba80347fc4764c2 (diff) | |
| download | rust-541d7cc65c56402f31335e41075838c0da5fbe01.tar.gz rust-541d7cc65c56402f31335e41075838c0da5fbe01.zip | |
Rename `AddToDiagnostic` as `Subdiagnostic`.
To match `derive(Subdiagnostic)`.
Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
Diffstat (limited to 'compiler/rustc_lint/src/internal.rs')
| -rw-r--r-- | compiler/rustc_lint/src/internal.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index bf5646b4651..edbd0bb1923 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 `Diagnostic`, `AddToDiagnostic`, or + /// `#[rustc_lint_diagnostics]` that are outside an `Diagnostic`, `Subdiagnostic`, 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 `Diagnostic`/`AddToDiagnostic` impls", + "prevent creation of diagnostics outside of `Diagnostic`/`Subdiagnostic` 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 `Diagnostic`, `AddToDiagnostic`, or `DecorateLint`, or + // - inside an impl of `Diagnostic`, `Subdiagnostic`, or `DecorateLint`, or // - inside a parent function that is itself marked with `#[rustc_lint_diagnostics]`. // // Otherwise, emit a `DIAGNOSTIC_OUTSIDE_OF_IMPL` lint. @@ -467,7 +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::Diagnostic | sym::AddToDiagnostic | sym::DecorateLint) + && matches!(name, sym::Diagnostic | sym::Subdiagnostic | sym::DecorateLint) { is_inside_appropriate_impl = true; break; |
