@@ -27,7 +27,7 @@ use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
27
27
use rustc_target:: spec:: abi:: { self , Abi } ;
28
28
use std:: borrow:: Cow ;
29
29
use std:: cmp:: Ordering ;
30
- use std:: fmt:: { self , Display } ;
30
+ use std:: fmt;
31
31
use std:: marker:: PhantomData ;
32
32
use std:: ops:: { ControlFlow , Deref , Range } ;
33
33
use ty:: util:: IntTypeExt ;
@@ -878,6 +878,12 @@ impl<'tcx> PolyTraitRef<'tcx> {
878
878
}
879
879
}
880
880
881
+ impl < ' tcx > IntoDiagnosticArg for TraitRef < ' tcx > {
882
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
883
+ self . to_string ( ) . into_diagnostic_arg ( )
884
+ }
885
+ }
886
+
881
887
/// An existential reference to a trait, where `Self` is erased.
882
888
/// For example, the trait object `Trait<'a, 'b, X, Y>` is:
883
889
/// ```ignore (illustrative)
@@ -918,6 +924,12 @@ impl<'tcx> ExistentialTraitRef<'tcx> {
918
924
}
919
925
}
920
926
927
+ impl < ' tcx > IntoDiagnosticArg for ExistentialTraitRef < ' tcx > {
928
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
929
+ self . to_string ( ) . into_diagnostic_arg ( )
930
+ }
931
+ }
932
+
921
933
pub type PolyExistentialTraitRef < ' tcx > = Binder < ' tcx , ExistentialTraitRef < ' tcx > > ;
922
934
923
935
impl < ' tcx > PolyExistentialTraitRef < ' tcx > {
@@ -1150,10 +1162,10 @@ impl<'tcx, T: IntoIterator> Binder<'tcx, T> {
1150
1162
1151
1163
impl < ' tcx , T > IntoDiagnosticArg for Binder < ' tcx , T >
1152
1164
where
1153
- Binder < ' tcx , T > : Display ,
1165
+ T : IntoDiagnosticArg ,
1154
1166
{
1155
1167
fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
1156
- self . to_string ( ) . into_diagnostic_arg ( )
1168
+ self . 0 . into_diagnostic_arg ( )
1157
1169
}
1158
1170
}
1159
1171
@@ -1373,6 +1385,12 @@ impl<'tcx> FnSig<'tcx> {
1373
1385
}
1374
1386
}
1375
1387
1388
+ impl < ' tcx > IntoDiagnosticArg for FnSig < ' tcx > {
1389
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
1390
+ self . to_string ( ) . into_diagnostic_arg ( )
1391
+ }
1392
+ }
1393
+
1376
1394
pub type PolyFnSig < ' tcx > = Binder < ' tcx , FnSig < ' tcx > > ;
1377
1395
1378
1396
impl < ' tcx > PolyFnSig < ' tcx > {
0 commit comments