Rollup merge of #153401 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer

Migrationg of `LintDiagnostic` - part 7

Part of https://github.com/rust-lang/rust/issues/153099.

This PR removes the `LintDiagnostic` trait and proc-macro. \o/

r? @JonathanBrouwer
This commit is contained in:
Jonathan Brouwer
2026-03-04 19:30:40 +01:00
committed by GitHub
16 changed files with 122 additions and 338 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
use crate::{Diag, DiagCtxtHandle, Diagnostic, Level};
/// We can't implement `LintDiagnostic` for `BuiltinLintDiag`, because decorating some of its
/// We can't implement `Diagnostic` for `BuiltinLintDiag`, because decorating some of its
/// variants requires types we don't have yet. So, handle that case separately.
pub enum DecorateDiagCompat {
Dynamic(Box<dyn for<'a> FnOnce(DiagCtxtHandle<'a>, Level) -> Diag<'a, ()> + DynSend + 'static>),
-8
View File
@@ -138,14 +138,6 @@ pub trait Subdiagnostic
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>);
}
/// Trait implemented by lint types. This should not be implemented manually. Instead, use
/// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic].
#[rustc_diagnostic_item = "LintDiagnostic"]
pub trait LintDiagnostic<'a, G: EmissionGuarantee> {
/// Decorate a lint with the information from this type.
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, G>);
}
#[derive(Clone, Debug, Encodable, Decodable)]
pub(crate) struct DiagLocation {
file: Cow<'static, str>,
+1 -1
View File
@@ -38,7 +38,7 @@
pub use decorate_diag::{BufferedEarlyLint, DecorateDiagCompat, LintBuffer};
pub use diagnostic::{
BugAbort, Diag, DiagInner, DiagStyledString, Diagnostic, EmissionGuarantee, FatalAbort,
LintDiagnostic, StringPart, Subdiag, Subdiagnostic,
StringPart, Subdiag, Subdiagnostic,
};
pub use diagnostic_impls::{
DiagSymbolList, ElidedLifetimeInPathSubdiag, ExpectedLifetimeParameter,