1
Fork 0

Rename AddToDiagnostic as Subdiagnostic.

To match `derive(Subdiagnostic)`.

Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
This commit is contained in:
Nicholas Nethercote 2024-03-06 14:00:16 +11:00
parent 7a294e998b
commit 541d7cc65c
28 changed files with 153 additions and 153 deletions

View file

@ -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;