Rename AddToDiagnostic
as Subdiagnostic
.
To match `derive(Subdiagnostic)`. Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
This commit is contained in:
parent
7a294e998b
commit
541d7cc65c
28 changed files with 153 additions and 153 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{codes::*, AddToDiagnostic, Diag, EmissionGuarantee, SubdiagMessageOp};
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
@ -23,8 +23,8 @@ pub enum OverruledAttributeSub {
|
|||
CommandLineSource,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for OverruledAttributeSub {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for OverruledAttributeSub {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::num::NonZero;
|
|||
use crate::errors::RequestedLevel;
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
codes::*, AddToDiagnostic, Applicability, DecorateLint, Diag, DiagMessage, DiagStyledString,
|
||||
EmissionGuarantee, SubdiagMessageOp, SuggestionStyle,
|
||||
codes::*, Applicability, DecorateLint, Diag, DiagMessage, DiagStyledString, EmissionGuarantee,
|
||||
SubdiagMessageOp, Subdiagnostic, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
|
@ -270,8 +270,8 @@ pub struct SuggestChangingAssocTypes<'a, 'b> {
|
|||
pub ty: &'a rustc_hir::Ty<'b>,
|
||||
}
|
||||
|
||||
impl<'a, 'b> AddToDiagnostic for SuggestChangingAssocTypes<'a, 'b> {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl<'a, 'b> Subdiagnostic for SuggestChangingAssocTypes<'a, 'b> {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -326,8 +326,8 @@ pub struct BuiltinTypeAliasGenericBoundsSuggestion {
|
|||
pub suggestions: Vec<(Span, String)>,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for BuiltinTypeAliasGenericBoundsSuggestion {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for BuiltinTypeAliasGenericBoundsSuggestion {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -434,7 +434,7 @@ impl<'a> DecorateLint<'a, ()> for BuiltinUnpermittedTypeInit<'_> {
|
|||
fluent::lint_builtin_unpermitted_type_init_label_suggestion,
|
||||
);
|
||||
}
|
||||
self.sub.add_to_diagnostic(diag);
|
||||
self.sub.add_to_diag(diag);
|
||||
}
|
||||
|
||||
fn msg(&self) -> DiagMessage {
|
||||
|
@ -447,8 +447,8 @@ pub struct BuiltinUnpermittedTypeInitSub {
|
|||
pub err: InitError,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for BuiltinUnpermittedTypeInitSub {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for BuiltinUnpermittedTypeInitSub {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -502,8 +502,8 @@ pub struct BuiltinClashingExternSub<'a> {
|
|||
pub found: Ty<'a>,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for BuiltinClashingExternSub<'_> {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for BuiltinClashingExternSub<'_> {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -784,8 +784,8 @@ pub struct HiddenUnicodeCodepointsDiagLabels {
|
|||
pub spans: Vec<(char, Span)>,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for HiddenUnicodeCodepointsDiagLabels {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for HiddenUnicodeCodepointsDiagLabels {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -802,8 +802,8 @@ pub enum HiddenUnicodeCodepointsDiagSub {
|
|||
}
|
||||
|
||||
// Used because of multiple multipart_suggestion and note
|
||||
impl AddToDiagnostic for HiddenUnicodeCodepointsDiagSub {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -950,8 +950,8 @@ pub struct NonBindingLetSub {
|
|||
pub is_assign_desugar: bool,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for NonBindingLetSub {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for NonBindingLetSub {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -1236,8 +1236,8 @@ pub enum NonSnakeCaseDiagSub {
|
|||
SuggestionAndNote { span: Span },
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for NonSnakeCaseDiagSub {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for NonSnakeCaseDiagSub {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
@ -1478,8 +1478,8 @@ pub enum OverflowingBinHexSign {
|
|||
Negative,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for OverflowingBinHexSign {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for OverflowingBinHexSign {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_f: F,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue