1
Fork 0

Rename IntoDiagnostic as Diagnostic.

To match `derive(Diagnostic)`.

Also rename `into_diagnostic` as `into_diag`.
This commit is contained in:
Nicholas Nethercote 2024-03-06 11:02:56 +11:00
parent a09b1d33a7
commit 7a294e998b
28 changed files with 146 additions and 164 deletions

View file

@ -1,7 +1,7 @@
use crate::fluent_generated as fluent;
use rustc_errors::{
codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic,
Level, SubdiagMessageOp,
codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level,
SubdiagMessageOp,
};
use rustc_macros::Diagnostic;
use rustc_middle::ty::{self, ClosureKind, PolyTraitRef, Ty};
@ -57,9 +57,9 @@ pub struct NegativePositiveConflict<'tcx> {
pub positive_impl_span: Result<Span, Symbol>,
}
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for NegativePositiveConflict<'_> {
impl<G: EmissionGuarantee> Diagnostic<'_, G> for NegativePositiveConflict<'_> {
#[track_caller]
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(dcx, level, fluent::trait_selection_negative_positive_conflict);
diag.arg("trait_desc", self.trait_desc.print_only_trait_path().to_string());
diag.arg("self_desc", self.self_ty.map_or_else(|| "none".to_string(), |ty| ty.to_string()));