UPDATE - rename DiagnosticHandler trait to IntoDiagnostic
This commit is contained in:
parent
5b8152807c
commit
19b348fed4
46 changed files with 659 additions and 584 deletions
|
@ -1,9 +1,9 @@
|
|||
use rustc_errors::{fluent, AddSubdiagnostic, ErrorGuaranteed, Handler, SessionDiagnostic};
|
||||
use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
|
||||
use rustc_errors::{fluent, AddSubdiagnostic, IntoDiagnostic, ErrorGuaranteed, Handler};
|
||||
use rustc_macros::{DiagnosticHandler, SessionSubdiagnostic};
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::overruled_attribute, code = "E0453")]
|
||||
pub struct OverruledAttribute {
|
||||
#[primary_span]
|
||||
|
@ -42,7 +42,7 @@ impl AddSubdiagnostic for OverruledAttributeSub {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::malformed_attribute, code = "E0452")]
|
||||
pub struct MalformedAttribute {
|
||||
#[primary_span]
|
||||
|
@ -61,7 +61,7 @@ pub enum MalformedAttributeSub {
|
|||
ReasonMustComeLast(#[primary_span] Span),
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::unknown_tool_in_scoped_lint, code = "E0710")]
|
||||
pub struct UnknownToolInScopedLint {
|
||||
#[primary_span]
|
||||
|
@ -72,7 +72,7 @@ pub struct UnknownToolInScopedLint {
|
|||
pub is_nightly_build: Option<()>,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::builtin_ellipsis_inclusive_range_patterns, code = "E0783")]
|
||||
pub struct BuiltinEllpisisInclusiveRangePatterns {
|
||||
#[primary_span]
|
||||
|
@ -107,7 +107,7 @@ impl AddSubdiagnostic for RequestedLevel {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::unsupported_group, code = "E0602")]
|
||||
pub struct UnsupportedGroup {
|
||||
pub lint_group: String,
|
||||
|
@ -119,7 +119,7 @@ pub struct CheckNameUnknown {
|
|||
pub sub: RequestedLevel,
|
||||
}
|
||||
|
||||
impl SessionDiagnostic<'_> for CheckNameUnknown {
|
||||
impl IntoDiagnostic<'_> for CheckNameUnknown {
|
||||
fn into_diagnostic(
|
||||
self,
|
||||
handler: &Handler,
|
||||
|
@ -136,7 +136,7 @@ impl SessionDiagnostic<'_> for CheckNameUnknown {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::check_name_unknown_tool, code = "E0602")]
|
||||
pub struct CheckNameUnknownTool {
|
||||
pub tool_name: Symbol,
|
||||
|
@ -144,7 +144,7 @@ pub struct CheckNameUnknownTool {
|
|||
pub sub: RequestedLevel,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::check_name_warning)]
|
||||
pub struct CheckNameWarning {
|
||||
pub msg: String,
|
||||
|
@ -152,7 +152,7 @@ pub struct CheckNameWarning {
|
|||
pub sub: RequestedLevel,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[derive(DiagnosticHandler)]
|
||||
#[diag(lint::check_name_deprecated)]
|
||||
pub struct CheckNameDeprecated {
|
||||
pub lint_name: String,
|
||||
|
|
|
@ -372,7 +372,7 @@ declare_tool_lint! {
|
|||
declare_tool_lint! {
|
||||
pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL,
|
||||
Allow,
|
||||
"prevent creation of diagnostics outside of `SessionDiagnostic`/`AddSubdiagnostic` impls",
|
||||
"prevent creation of diagnostics outside of `DiagnosticHandler`/`AddSubdiagnostic` impls",
|
||||
report_in_external_macro: true
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,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::SessionDiagnostic | sym::AddSubdiagnostic | sym::DecorateLint)
|
||||
matches!(name, sym::DiagnosticHandler | sym::AddSubdiagnostic | sym::DecorateLint)
|
||||
{
|
||||
found_impl = true;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue