@@ -5,7 +5,7 @@ use std::borrow::Cow;
5
5
use rustc_errors:: codes:: * ;
6
6
use rustc_errors:: {
7
7
Applicability , Diag , DiagArgValue , DiagSymbolList , EmissionGuarantee , IntoDiagArg , MultiSpan ,
8
- SubdiagMessageOp , Subdiagnostic ,
8
+ Subdiagnostic ,
9
9
} ;
10
10
use rustc_macros:: { Diagnostic , LintDiagnostic , Subdiagnostic } ;
11
11
use rustc_middle:: ty:: { self , Ty } ;
@@ -270,11 +270,7 @@ pub(crate) struct SuggestAnnotations {
270
270
pub suggestions : Vec < SuggestAnnotation > ,
271
271
}
272
272
impl Subdiagnostic for SuggestAnnotations {
273
- fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
274
- self ,
275
- diag : & mut Diag < ' _ , G > ,
276
- _: & F ,
277
- ) {
273
+ fn add_to_diag < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
278
274
if self . suggestions . is_empty ( ) {
279
275
return ;
280
276
}
@@ -337,11 +333,7 @@ pub(crate) struct TypeMismatchFruTypo {
337
333
}
338
334
339
335
impl Subdiagnostic for TypeMismatchFruTypo {
340
- fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
341
- self ,
342
- diag : & mut Diag < ' _ , G > ,
343
- _f : & F ,
344
- ) {
336
+ fn add_to_diag < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
345
337
diag. arg ( "expr" , self . expr . as_deref ( ) . unwrap_or ( "NONE" ) ) ;
346
338
347
339
// Only explain that `a ..b` is a range if it's split up
@@ -599,11 +591,7 @@ pub(crate) struct RemoveSemiForCoerce {
599
591
}
600
592
601
593
impl Subdiagnostic for RemoveSemiForCoerce {
602
- fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
603
- self ,
604
- diag : & mut Diag < ' _ , G > ,
605
- _f : & F ,
606
- ) {
594
+ fn add_to_diag < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
607
595
let mut multispan: MultiSpan = self . semi . into ( ) ;
608
596
multispan. push_span_label ( self . expr , fluent:: hir_typeck_remove_semi_for_coerce_expr) ;
609
597
multispan. push_span_label ( self . ret , fluent:: hir_typeck_remove_semi_for_coerce_ret) ;
@@ -778,20 +766,16 @@ pub(crate) enum CastUnknownPointerSub {
778
766
}
779
767
780
768
impl rustc_errors:: Subdiagnostic for CastUnknownPointerSub {
781
- fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
782
- self ,
783
- diag : & mut Diag < ' _ , G > ,
784
- f : & F ,
785
- ) {
769
+ fn add_to_diag < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
786
770
match self {
787
771
CastUnknownPointerSub :: To ( span) => {
788
- let msg = f ( diag, crate :: fluent_generated :: hir_typeck_label_to) ;
772
+ let msg = diag. eagerly_translate ( fluent :: hir_typeck_label_to) ;
789
773
diag. span_label ( span, msg) ;
790
- let msg = f ( diag, crate :: fluent_generated :: hir_typeck_note) ;
774
+ let msg = diag. eagerly_translate ( fluent :: hir_typeck_note) ;
791
775
diag. note ( msg) ;
792
776
}
793
777
CastUnknownPointerSub :: From ( span) => {
794
- let msg = f ( diag, crate :: fluent_generated :: hir_typeck_label_from) ;
778
+ let msg = diag. eagerly_translate ( fluent :: hir_typeck_label_from) ;
795
779
diag. span_label ( span, msg) ;
796
780
}
797
781
}
0 commit comments