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> + '_ {
702
702
pub ( crate ) fn complain_about_missing_assoc_tys (
703
703
& self ,
704
704
associated_types : FxIndexMap < Span , FxIndexSet < DefId > > ,
705
- potential_assoc_types : Vec < Span > ,
705
+ potential_assoc_types : Vec < usize > ,
706
706
trait_bounds : & [ hir:: PolyTraitRef < ' _ > ] ,
707
707
) {
708
708
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(
474
474
return Ok ( ( ) ) ;
475
475
}
476
476
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) ;
482
478
483
479
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
- ) ;
487
480
let num_redundant_args = provided_args - min_expected_args;
488
481
GenericArgsInfo :: ExcessLifetimes { num_redundant_args }
489
482
} else {
@@ -538,11 +531,7 @@ pub(crate) fn check_generic_arg_count(
538
531
let num_default_params = expected_max - expected_min;
539
532
540
533
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) ) ;
546
535
let num_redundant_args = provided - expected_max;
547
536
548
537
// 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 {
218
218
#[ derive( Clone , Debug ) ]
219
219
pub struct GenericArgCountMismatch {
220
220
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 > ,
223
223
}
224
224
225
225
/// Decorates the result of a generic argument count mismatch
You can’t perform that action at this time.
0 commit comments