@@ -4580,7 +4580,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4580
4580
// Check provided lifetime parameters.
4581
4581
let lifetime_defs = segment. map_or ( & [ ] [ ..] , |( _, generics) | & generics. regions ) ;
4582
4582
if lifetimes. len ( ) > lifetime_defs. len ( ) {
4583
- let span = lifetimes[ lifetime_defs. len ( ) ] . span ;
4584
4583
struct_span_err ! ( self . tcx. sess, span, E0088 ,
4585
4584
"too many lifetime parameters provided: \
4586
4585
expected {}, found {}",
@@ -4589,6 +4588,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4589
4588
. span_label ( span, & format ! ( "unexpected lifetime parameter{}" ,
4590
4589
match lifetimes. len( ) { 1 => "" , _ => "s" } ) )
4591
4590
. emit ( ) ;
4591
+ } else if lifetimes. len ( ) > 0 && lifetimes. len ( ) < lifetime_defs. len ( ) {
4592
+ struct_span_err ! ( self . tcx. sess, span, E0090 ,
4593
+ "too few lifetime parameters provided: \
4594
+ expected {}, found {}",
4595
+ count( lifetime_defs. len( ) ) ,
4596
+ count( lifetimes. len( ) ) )
4597
+ . span_label ( span, & format ! ( "too few lifetime parameters" ) )
4598
+ . emit ( ) ;
4592
4599
}
4593
4600
4594
4601
// The case where there is not enough lifetime parameters is not checked,
0 commit comments