@@ -227,6 +227,36 @@ impl IntoDiagArg for rustc_lint_defs::Level {
227227 }
228228}
229229
230+ impl < Id > IntoDiagArg for hir:: def:: Res < Id > {
231+ fn into_diag_arg ( self ) -> DiagArgValue {
232+ DiagArgValue :: Str ( Cow :: Borrowed ( self . descr ( ) ) )
233+ }
234+ }
235+
236+ impl IntoDiagArg for DiagLocation {
237+ fn into_diag_arg ( self ) -> DiagArgValue {
238+ DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
239+ }
240+ }
241+
242+ impl IntoDiagArg for Backtrace {
243+ fn into_diag_arg ( self ) -> DiagArgValue {
244+ DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
245+ }
246+ }
247+
248+ impl IntoDiagArg for Level {
249+ fn into_diag_arg ( self ) -> DiagArgValue {
250+ DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
251+ }
252+ }
253+
254+ impl IntoDiagArg for type_ir:: ClosureKind {
255+ fn into_diag_arg ( self ) -> DiagArgValue {
256+ DiagArgValue :: Str ( self . as_str ( ) . into ( ) )
257+ }
258+ }
259+
230260#[ derive( Clone ) ]
231261pub struct DiagSymbolList ( Vec < Symbol > ) ;
232262
@@ -244,12 +274,6 @@ impl IntoDiagArg for DiagSymbolList {
244274 }
245275}
246276
247- impl < Id > IntoDiagArg for hir:: def:: Res < Id > {
248- fn into_diag_arg ( self ) -> DiagArgValue {
249- DiagArgValue :: Str ( Cow :: Borrowed ( self . descr ( ) ) )
250- }
251- }
252-
253277impl < G : EmissionGuarantee > Diagnostic < ' _ , G > for TargetDataLayoutErrors < ' _ > {
254278 fn into_diag ( self , dcx : & DiagCtxt , level : Level ) -> Diag < ' _ , G > {
255279 match self {
@@ -302,7 +326,7 @@ impl Subdiagnostic for SingleLabelManySpans {
302326 fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
303327 self ,
304328 diag : & mut Diag < ' _ , G > ,
305- _: F ,
329+ _: & F ,
306330 ) {
307331 diag. span_labels ( self . spans , self . label ) ;
308332 }
@@ -316,24 +340,6 @@ pub struct ExpectedLifetimeParameter {
316340 pub count : usize ,
317341}
318342
319- impl IntoDiagArg for DiagLocation {
320- fn into_diag_arg ( self ) -> DiagArgValue {
321- DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
322- }
323- }
324-
325- impl IntoDiagArg for Backtrace {
326- fn into_diag_arg ( self ) -> DiagArgValue {
327- DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
328- }
329- }
330-
331- impl IntoDiagArg for Level {
332- fn into_diag_arg ( self ) -> DiagArgValue {
333- DiagArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
334- }
335- }
336-
337343#[ derive( Subdiagnostic ) ]
338344#[ suggestion( errors_indicate_anonymous_lifetime, code = "{suggestion}" , style = "verbose" ) ]
339345pub struct IndicateAnonymousLifetime {
@@ -343,8 +349,10 @@ pub struct IndicateAnonymousLifetime {
343349 pub suggestion : String ,
344350}
345351
346- impl IntoDiagArg for type_ir:: ClosureKind {
347- fn into_diag_arg ( self ) -> DiagArgValue {
348- DiagArgValue :: Str ( self . as_str ( ) . into ( ) )
349- }
352+ #[ derive( Subdiagnostic ) ]
353+ pub struct ElidedLifetimeInPathSubdiag {
354+ #[ subdiagnostic]
355+ pub expected : ExpectedLifetimeParameter ,
356+ #[ subdiagnostic]
357+ pub indicate : Option < IndicateAnonymousLifetime > ,
350358}
0 commit comments