File tree Expand file tree Collapse file tree 3 files changed +5
-16
lines changed
compiler/rustc_hir_analysis/src/hir_ty_lowering Expand file tree Collapse file tree 3 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -702,7 +702,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
702702 pub ( crate ) fn complain_about_missing_assoc_tys (
703703 & self ,
704704 associated_types : FxIndexMap < Span , FxIndexSet < DefId > > ,
705- potential_assoc_types : Vec < Span > ,
705+ potential_assoc_types : Vec < usize > ,
706706 trait_bounds : & [ hir:: PolyTraitRef < ' _ > ] ,
707707 ) {
708708 if associated_types. values ( ) . all ( |v| v. is_empty ( ) ) {
Original file line number Diff line number Diff line change @@ -474,16 +474,9 @@ pub(crate) fn check_generic_arg_count(
474474 return Ok ( ( ) ) ;
475475 }
476476
477- if provided_args > max_expected_args {
478- invalid_args. extend (
479- gen_args. args [ max_expected_args..provided_args] . iter ( ) . map ( |arg| arg. span ( ) ) ,
480- ) ;
481- } ;
477+ invalid_args. extend ( min_expected_args..provided_args) ;
482478
483479 let gen_args_info = if provided_args > min_expected_args {
484- invalid_args. extend (
485- gen_args. args [ min_expected_args..provided_args] . iter ( ) . map ( |arg| arg. span ( ) ) ,
486- ) ;
487480 let num_redundant_args = provided_args - min_expected_args;
488481 GenericArgsInfo :: ExcessLifetimes { num_redundant_args }
489482 } else {
@@ -538,11 +531,7 @@ pub(crate) fn check_generic_arg_count(
538531 let num_default_params = expected_max - expected_min;
539532
540533 let gen_args_info = if provided > expected_max {
541- invalid_args. extend (
542- gen_args. args [ args_offset + expected_max..args_offset + provided]
543- . iter ( )
544- . map ( |arg| arg. span ( ) ) ,
545- ) ;
534+ invalid_args. extend ( ( expected_max..provided) . map ( |i| i + args_offset) ) ;
546535 let num_redundant_args = provided - expected_max;
547536
548537 // Provide extra note if synthetic arguments like `impl Trait` are specified.
Original file line number Diff line number Diff line change @@ -218,8 +218,8 @@ pub(crate) enum GenericArgPosition {
218218#[ derive( Clone , Debug ) ]
219219pub struct GenericArgCountMismatch {
220220 pub reported : ErrorGuaranteed ,
221- /// A list of spans of arguments provided that were not valid.
222- pub invalid_args : Vec < Span > ,
221+ /// A list of indices of arguments provided that were not valid.
222+ pub invalid_args : Vec < usize > ,
223223}
224224
225225/// Decorates the result of a generic argument count mismatch
You can’t perform that action at this time.
0 commit comments