Fix source ordering of IntoDiagArg impls

This commit is contained in:
Xiretza 2024-04-20 12:57:29 +00:00
parent c88bb6c011
commit b220b741c6

View File

@ -227,6 +227,36 @@ impl IntoDiagArg for rustc_lint_defs::Level {
} }
} }
impl<Id> IntoDiagArg for hir::def::Res<Id> {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::Borrowed(self.descr()))
}
}
impl IntoDiagArg for DiagLocation {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
impl IntoDiagArg for Backtrace {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
impl IntoDiagArg for Level {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
impl IntoDiagArg for type_ir::ClosureKind {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(self.as_str().into())
}
}
#[derive(Clone)] #[derive(Clone)]
pub struct DiagSymbolList(Vec<Symbol>); pub struct DiagSymbolList(Vec<Symbol>);
@ -244,12 +274,6 @@ impl IntoDiagArg for DiagSymbolList {
} }
} }
impl<Id> IntoDiagArg for hir::def::Res<Id> {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::Borrowed(self.descr()))
}
}
impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> { impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> {
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> { fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
match self { match self {
@ -316,24 +340,6 @@ pub struct ExpectedLifetimeParameter {
pub count: usize, pub count: usize,
} }
impl IntoDiagArg for DiagLocation {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
impl IntoDiagArg for Backtrace {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
impl IntoDiagArg for Level {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[suggestion(errors_indicate_anonymous_lifetime, code = "{suggestion}", style = "verbose")] #[suggestion(errors_indicate_anonymous_lifetime, code = "{suggestion}", style = "verbose")]
pub struct IndicateAnonymousLifetime { pub struct IndicateAnonymousLifetime {
@ -342,9 +348,3 @@ pub struct IndicateAnonymousLifetime {
pub count: usize, pub count: usize,
pub suggestion: String, pub suggestion: String,
} }
impl IntoDiagArg for type_ir::ClosureKind {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(self.as_str().into())
}
}