@@ -4565,7 +4565,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4565
4565
// Check provided lifetime parameters.
4566
4566
let lifetime_defs = segment. map_or ( & [ ] [ ..] , |( _, generics) | & generics. regions ) ;
4567
4567
if lifetimes. len ( ) > lifetime_defs. len ( ) {
4568
- let span = lifetimes[ lifetime_defs. len ( ) ] . span ;
4569
4568
struct_span_err ! ( self . tcx. sess, span, E0088 ,
4570
4569
"too many lifetime parameters provided: \
4571
4570
expected {}, found {}",
@@ -4574,6 +4573,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4574
4573
. span_label ( span, & format ! ( "unexpected lifetime parameter{}" ,
4575
4574
match lifetimes. len( ) { 1 => "" , _ => "s" } ) )
4576
4575
. emit ( ) ;
4576
+ } else if lifetimes. len ( ) > 0 && lifetimes. len ( ) < lifetime_defs. len ( ) {
4577
+ struct_span_err ! ( self . tcx. sess, span, E0090 ,
4578
+ "too few lifetime parameters provided: \
4579
+ expected {}, found {}",
4580
+ count( lifetime_defs. len( ) ) ,
4581
+ count( lifetimes. len( ) ) )
4582
+ . span_label ( span, & format ! ( "too few lifetime parameters" ) )
4583
+ . emit ( ) ;
4577
4584
}
4578
4585
4579
4586
// The case where there is not enough lifetime parameters is not checked,
0 commit comments