@@ -227,6 +227,36 @@ impl IntoDiagArg for rustc_lint_defs::Level {
227
227
}
228
228
}
229
229
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
+
230
260
#[ derive( Clone ) ]
231
261
pub struct DiagSymbolList ( Vec < Symbol > ) ;
232
262
@@ -244,12 +274,6 @@ impl IntoDiagArg for DiagSymbolList {
244
274
}
245
275
}
246
276
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
-
253
277
impl < G : EmissionGuarantee > Diagnostic < ' _ , G > for TargetDataLayoutErrors < ' _ > {
254
278
fn into_diag ( self , dcx : & DiagCtxt , level : Level ) -> Diag < ' _ , G > {
255
279
match self {
@@ -302,7 +326,7 @@ impl Subdiagnostic for SingleLabelManySpans {
302
326
fn add_to_diag_with < G : EmissionGuarantee , F : SubdiagMessageOp < G > > (
303
327
self ,
304
328
diag : & mut Diag < ' _ , G > ,
305
- _: F ,
329
+ _: & F ,
306
330
) {
307
331
diag. span_labels ( self . spans , self . label ) ;
308
332
}
@@ -316,24 +340,6 @@ pub struct ExpectedLifetimeParameter {
316
340
pub count : usize ,
317
341
}
318
342
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
-
337
343
#[ derive( Subdiagnostic ) ]
338
344
#[ suggestion( errors_indicate_anonymous_lifetime, code = "{suggestion}" , style = "verbose" ) ]
339
345
pub struct IndicateAnonymousLifetime {
@@ -343,8 +349,10 @@ pub struct IndicateAnonymousLifetime {
343
349
pub suggestion : String ,
344
350
}
345
351
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 > ,
350
358
}
0 commit comments