@@ -409,9 +409,8 @@ impl LateLintPass<'_> for Diagnostics {
409409 }
410410 } ;
411411
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 ! [ ] ;
415414 let fn_sig = cx. tcx . fn_sig ( def_id) . instantiate_identity ( ) . skip_binder ( ) ;
416415 let predicates = cx. tcx . predicates_of ( def_id) . instantiate_identity ( cx. tcx ) . predicates ;
417416 for ( i, & param_ty) in fn_sig. inputs ( ) . iter ( ) . enumerate ( ) {
@@ -425,20 +424,14 @@ impl LateLintPass<'_> for Diagnostics {
425424 && let ty1 = trait_ref. args . type_at ( 1 )
426425 && is_diag_message ( ty1)
427426 {
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 ) ) ;
435428 }
436429 }
437430 }
438431 }
439432
440433 // 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 ( ) {
442435 return ;
443436 }
444437
@@ -481,7 +474,7 @@ impl LateLintPass<'_> for Diagnostics {
481474 // Calls to methods with an `impl Into<{D,Subd}iagMessage>` parameter must be passed an arg
482475 // with type `{D,Subd}iagMessage` or `impl Into<{D,Subd}iagMessage>`. Otherwise, emit an
483476 // `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 {
485478 // Is the arg type `{Sub,D}iagMessage`or `impl Into<{Sub,D}iagMessage>`?
486479 let arg_ty = call_tys[ param_i] ;
487480 let is_translatable = is_diag_message ( arg_ty)
0 commit comments