1
Fork 0

Pass translation closure to add_to_diag_with() as reference

This commit is contained in:
Xiretza 2024-04-18 19:18:35 +00:00
parent 13eb8c736c
commit 5646b65cf5
17 changed files with 41 additions and 41 deletions

View file

@ -239,7 +239,7 @@ impl Subdiagnostic for RegionOriginNote<'_> {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_f: F,
_f: &F,
) {
let mut label_or_note = |span, msg: DiagMessage| {
let sub_count = diag.children.iter().filter(|d| d.span.is_dummy()).count();
@ -304,7 +304,7 @@ impl Subdiagnostic for LifetimeMismatchLabels {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_f: F,
_f: &F,
) {
match self {
LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => {
@ -352,7 +352,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_f: F,
_f: &F,
) {
let mut mk_suggestion = || {
let (
@ -454,7 +454,7 @@ impl Subdiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
mut self,
diag: &mut Diag<'_, G>,
_f: F,
_f: &F,
) {
self.unmet_requirements
.push_span_label(self.binding_span, fluent::infer_msl_introduces_static);
@ -773,7 +773,7 @@ impl Subdiagnostic for ConsiderBorrowingParamHelp {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
f: F,
f: &F,
) {
let mut type_param_span: MultiSpan = self.spans.clone().into();
for &span in &self.spans {
@ -818,7 +818,7 @@ impl Subdiagnostic for DynTraitConstraintSuggestion {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
f: F,
f: &F,
) {
let mut multi_span: MultiSpan = vec![self.span].into();
multi_span.push_span_label(self.span, fluent::infer_dtcs_has_lifetime_req_label);
@ -865,7 +865,7 @@ impl Subdiagnostic for ReqIntroducedLocations {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
mut self,
diag: &mut Diag<'_, G>,
f: F,
f: &F,
) {
for sp in self.spans {
self.span.push_span_label(sp, fluent::infer_ril_introduced_here);
@ -888,7 +888,7 @@ impl Subdiagnostic for MoreTargeted {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_f: F,
_f: &F,
) {
diag.code(E0772);
diag.primary_message(fluent::infer_more_targeted);
@ -1293,7 +1293,7 @@ impl Subdiagnostic for SuggestTuplePatternMany {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
f: F,
f: &F,
) {
diag.arg("path", self.path);
let message = f(diag, crate::fluent_generated::infer_stp_wrap_many.into());