@@ -1423,9 +1423,10 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1423
1423
} else {
1424
1424
LifetimeUseSet :: Many
1425
1425
} ) ,
1426
- LifetimeRibKind :: Generics { .. }
1427
- | LifetimeRibKind :: ConstGeneric
1428
- | LifetimeRibKind :: AnonConst => None ,
1426
+ LifetimeRibKind :: Generics { .. } => None ,
1427
+ LifetimeRibKind :: ConstGeneric | LifetimeRibKind :: AnonConst => {
1428
+ span_bug ! ( ident. span, "unexpected rib kind: {:?}" , rib. kind)
1429
+ }
1429
1430
} )
1430
1431
. unwrap_or ( LifetimeUseSet :: Many ) ;
1431
1432
debug ! ( ?use_ctxt, ?use_set) ;
@@ -1460,7 +1461,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1460
1461
) ;
1461
1462
return ;
1462
1463
}
1463
- _ => { }
1464
+ LifetimeRibKind :: AnonymousCreateParameter { .. }
1465
+ | LifetimeRibKind :: Elided ( _)
1466
+ | LifetimeRibKind :: Generics { .. }
1467
+ | LifetimeRibKind :: ElisionFailure
1468
+ | LifetimeRibKind :: AnonymousReportError => { }
1464
1469
}
1465
1470
}
1466
1471
@@ -1534,9 +1539,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1534
1539
return ;
1535
1540
}
1536
1541
LifetimeRibKind :: Item => break ,
1537
- LifetimeRibKind :: Generics { .. }
1538
- | LifetimeRibKind :: ConstGeneric
1539
- | LifetimeRibKind :: AnonConst => { }
1542
+ LifetimeRibKind :: Generics { .. } | LifetimeRibKind :: ConstGeneric => { }
1543
+ LifetimeRibKind :: AnonConst => {
1544
+ // There is always an `Elided(LifetimeRes::Static)` inside an `AnonConst`.
1545
+ span_bug ! ( lifetime. ident. span, "unexpected rib kind: {:?}" , rib. kind)
1546
+ }
1540
1547
}
1541
1548
}
1542
1549
self . record_lifetime_res ( lifetime. id , LifetimeRes :: Error , elision_candidate) ;
@@ -1751,9 +1758,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1751
1758
self . report_missing_lifetime_specifiers ( vec ! [ missing_lifetime] , None ) ;
1752
1759
break ;
1753
1760
}
1754
- LifetimeRibKind :: Generics { .. }
1755
- | LifetimeRibKind :: ConstGeneric
1756
- | LifetimeRibKind :: AnonConst => { }
1761
+ LifetimeRibKind :: Generics { .. } | LifetimeRibKind :: ConstGeneric => { }
1762
+ LifetimeRibKind :: AnonConst => {
1763
+ // There is always an `Elided(LifetimeRes::Static)` inside an `AnonConst`.
1764
+ span_bug ! ( elided_lifetime_span, "unexpected rib kind: {:?}" , rib. kind)
1765
+ }
1757
1766
}
1758
1767
}
1759
1768
@@ -3938,7 +3947,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
3938
3947
fn_id : NodeId ,
3939
3948
async_node_id : Option < ( NodeId , Span ) > ,
3940
3949
) {
3941
- if let Some ( ( async_node_id, _ ) ) = async_node_id {
3950
+ if let Some ( ( async_node_id, span ) ) = async_node_id {
3942
3951
let mut extra_lifetime_params =
3943
3952
self . r . extra_lifetime_params_map . get ( & fn_id) . cloned ( ) . unwrap_or_default ( ) ;
3944
3953
for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
@@ -3952,7 +3961,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
3952
3961
extra_lifetime_params. extend ( earlier_fresh) ;
3953
3962
}
3954
3963
}
3955
- _ => { }
3964
+ LifetimeRibKind :: Generics { .. } => { }
3965
+ _ => {
3966
+ // We are in a function definition. We should only find `Generics`
3967
+ // and `AnonymousCreateParameter` inside the innermost `Item`.
3968
+ span_bug ! ( span, "unexpected rib kind: {:?}" , rib. kind)
3969
+ }
3956
3970
}
3957
3971
}
3958
3972
self . r . extra_lifetime_params_map . insert ( async_node_id, extra_lifetime_params) ;
0 commit comments