@@ -409,9 +409,8 @@ impl LateLintPass<'_> for Diagnostics {
409
409
}
410
410
} ;
411
411
412
- // Does the callee have a `impl Into<{D,Subd}iagMessage>` parameter? (There should be at
413
- // most one.)
414
- let mut impl_into_diagnostic_message_param = None ;
412
+ // Does the callee have one or more `impl Into<{D,Subd}iagMessage>` parameters?
413
+ let mut impl_into_diagnostic_message_params = vec ! [ ] ;
415
414
let fn_sig = cx. tcx . fn_sig ( def_id) . instantiate_identity ( ) . skip_binder ( ) ;
416
415
let predicates = cx. tcx . predicates_of ( def_id) . instantiate_identity ( cx. tcx ) . predicates ;
417
416
for ( i, & param_ty) in fn_sig. inputs ( ) . iter ( ) . enumerate ( ) {
@@ -425,20 +424,14 @@ impl LateLintPass<'_> for Diagnostics {
425
424
&& let ty1 = trait_ref. args . type_at ( 1 )
426
425
&& is_diag_message ( ty1)
427
426
{
428
- if impl_into_diagnostic_message_param. is_some ( ) {
429
- cx. tcx . dcx ( ) . span_bug (
430
- span,
431
- "can't handle multiple `impl Into<{D,Sub}iagMessage>` params" ,
432
- ) ;
433
- }
434
- impl_into_diagnostic_message_param = Some ( ( i, p. name ) ) ;
427
+ impl_into_diagnostic_message_params. push ( ( i, p. name ) ) ;
435
428
}
436
429
}
437
430
}
438
431
}
439
432
440
433
// Is the callee interesting?
441
- if !has_attr && impl_into_diagnostic_message_param . is_none ( ) {
434
+ if !has_attr && impl_into_diagnostic_message_params . is_empty ( ) {
442
435
return ;
443
436
}
444
437
@@ -481,7 +474,7 @@ impl LateLintPass<'_> for Diagnostics {
481
474
// Calls to methods with an `impl Into<{D,Subd}iagMessage>` parameter must be passed an arg
482
475
// with type `{D,Subd}iagMessage` or `impl Into<{D,Subd}iagMessage>`. Otherwise, emit an
483
476
// `UNTRANSLATABLE_DIAGNOSTIC` lint.
484
- if let Some ( ( param_i, param_i_p_name) ) = impl_into_diagnostic_message_param {
477
+ for ( param_i, param_i_p_name) in impl_into_diagnostic_message_params {
485
478
// Is the arg type `{Sub,D}iagMessage`or `impl Into<{Sub,D}iagMessage>`?
486
479
let arg_ty = call_tys[ param_i] ;
487
480
let is_translatable = is_diag_message ( arg_ty)
0 commit comments