@@ -449,47 +449,37 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
449
449
450
450
let mut unexpected_spans = vec ! [ ] ;
451
451
452
- let mut lifetime_count_correct = Ok ( ( ) ) ;
453
- if !infer_lifetimes || arg_counts. lifetimes > param_counts. lifetimes {
454
- lifetime_count_correct = check_kind_count (
455
- "lifetime" ,
456
- param_counts. lifetimes ,
457
- param_counts. lifetimes ,
458
- arg_counts. lifetimes ,
459
- 0 ,
460
- & mut unexpected_spans,
461
- explicit_late_bound == ExplicitLateBound :: Yes ,
462
- ) ;
463
- }
452
+ let lifetime_count_correct = check_kind_count (
453
+ "lifetime" ,
454
+ if infer_lifetimes { 0 } else { param_counts. lifetimes } ,
455
+ param_counts. lifetimes ,
456
+ arg_counts. lifetimes ,
457
+ 0 ,
458
+ & mut unexpected_spans,
459
+ explicit_late_bound == ExplicitLateBound :: Yes ,
460
+ ) ;
464
461
465
462
// FIXME(const_generics:defaults)
466
- let mut const_count_correct = Ok ( ( ) ) ;
467
- if !infer_args || arg_counts. consts > param_counts. consts {
468
- const_count_correct = check_kind_count (
469
- "const" ,
470
- param_counts. consts ,
471
- param_counts. consts ,
472
- arg_counts. consts ,
473
- arg_counts. lifetimes + arg_counts. types ,
474
- & mut unexpected_spans,
475
- false ,
476
- ) ;
477
- }
463
+ let mut const_count_correct = check_kind_count (
464
+ "const" ,
465
+ if infer_args { 0 } else { param_counts. consts } ,
466
+ param_counts. consts ,
467
+ arg_counts. consts ,
468
+ arg_counts. lifetimes + arg_counts. types ,
469
+ & mut unexpected_spans,
470
+ false ,
471
+ ) ;
478
472
479
473
// Note that type errors are currently be emitted *after* const errors.
480
- let mut type_count_correct = Ok ( ( ) ) ;
481
- if !infer_args || arg_counts. types > param_counts. types - defaults. types - has_self as usize
482
- {
483
- type_count_correct = check_kind_count (
484
- "type" ,
485
- param_counts. types - defaults. types - has_self as usize ,
486
- param_counts. types - has_self as usize ,
487
- arg_counts. types ,
488
- arg_counts. lifetimes ,
489
- & mut unexpected_spans,
490
- false ,
491
- ) ;
492
- }
474
+ let mut type_count_correct = check_kind_count (
475
+ "type" ,
476
+ if infer_args { 0 } else { param_counts. types - defaults. types - has_self as usize } ,
477
+ param_counts. types - has_self as usize ,
478
+ arg_counts. types ,
479
+ arg_counts. lifetimes ,
480
+ & mut unexpected_spans,
481
+ false ,
482
+ ) ;
493
483
494
484
// Emit a help message if it's possible that a type could be surrounded in braces
495
485
if let Err ( ( c_mismatch, Some ( ref mut _const_err) ) ) = const_count_correct {
0 commit comments