1
Fork 0

Add SubdiagnosticMessageOp as a trait alias.

It avoids a lot of repetition.
This commit is contained in:
Nicholas Nethercote 2024-02-06 16:35:19 +11:00
parent 0d531351e8
commit 6b175a848d
19 changed files with 68 additions and 181 deletions

View file

@ -2,7 +2,7 @@ use crate::diagnostic::DiagnosticLocation;
use crate::{fluent_generated as fluent, AddToDiagnostic};
use crate::{
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, ErrCode, IntoDiagnostic,
IntoDiagnosticArg, Level,
IntoDiagnosticArg, Level, SubdiagnosticMessageOp,
};
use rustc_ast as ast;
use rustc_ast_pretty::pprust;
@ -299,7 +299,7 @@ pub struct SingleLabelManySpans {
pub label: &'static str,
}
impl AddToDiagnostic for SingleLabelManySpans {
fn add_to_diagnostic_with<F>(self, diag: &mut crate::Diagnostic, _: F) {
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut crate::Diagnostic, _: F) {
diag.span_labels(self.spans, self.label);
}
}