1
Fork 0

Rename SubdiagnosticMessageOp as SubdiagMessageOp.

This commit is contained in:
Nicholas Nethercote 2024-02-29 16:18:19 +11:00
parent 60ea6e2831
commit 573267cf3c
18 changed files with 55 additions and 57 deletions

View file

@ -182,14 +182,14 @@ where
/// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used
/// (to optionally perform eager translation).
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
f: F,
);
}
pub trait SubdiagnosticMessageOp<G> = Fn(&mut Diag<'_, G>, SubdiagMessage) -> SubdiagMessage;
pub trait SubdiagMessageOp<G> = Fn(&mut Diag<'_, G>, SubdiagMessage) -> SubdiagMessage;
/// Trait implemented by lint types. This should not be implemented manually. Instead, use
/// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic].

View file

@ -2,7 +2,7 @@ use crate::diagnostic::DiagLocation;
use crate::{fluent_generated as fluent, AddToDiagnostic};
use crate::{
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg,
Level, SubdiagnosticMessageOp,
Level, SubdiagMessageOp,
};
use rustc_ast as ast;
use rustc_ast_pretty::pprust;
@ -298,7 +298,7 @@ pub struct SingleLabelManySpans {
pub label: &'static str,
}
impl AddToDiagnostic for SingleLabelManySpans {
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_: F,

View file

@ -39,7 +39,7 @@ pub use codes::*;
pub use diagnostic::{
AddToDiagnostic, BugAbort, DecorateLint, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue,
DiagInner, DiagStyledString, EmissionGuarantee, FatalAbort, IntoDiagnostic, IntoDiagnosticArg,
StringPart, Subdiag, SubdiagnosticMessageOp,
StringPart, Subdiag, SubdiagMessageOp,
};
pub use diagnostic_impls::{
DiagArgFromDisplay, DiagSymbolList, ExpectedLifetimeParameter, IndicateAnonymousLifetime,