@@ -1931,30 +1931,33 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19311931 source : LifetimeSource ,
19321932 syntax : LifetimeSyntax ,
19331933 ) -> & ' hir hir:: Lifetime {
1934- let res =
1935- self . resolver . get_lifetime_res ( id) . map_or (
1936- hir:: LifetimeKind :: NotFound ,
1937- |res| match res {
1938- LifetimeRes :: Param { param, .. } => hir:: LifetimeKind :: Param ( param) ,
1939- LifetimeRes :: Fresh { param, .. } => {
1940- assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1941- let param = self . local_def_id ( param) ;
1942- hir:: LifetimeKind :: Param ( param)
1943- }
1944- LifetimeRes :: Infer => {
1945- assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1946- hir:: LifetimeKind :: Infer
1947- }
1948- LifetimeRes :: Static { .. } => {
1949- assert ! ( matches!( ident. name, kw:: StaticLifetime | kw:: UnderscoreLifetime ) ) ;
1950- hir:: LifetimeKind :: Static
1951- }
1952- LifetimeRes :: Error ( guar) => hir:: LifetimeKind :: Error ( guar) ,
1953- LifetimeRes :: ElidedAnchor { .. } => {
1954- panic ! ( "Unexpected `ElidedAnchar` {:?} at {:?}" , ident, ident. span) ;
1955- }
1956- } ,
1957- ) ;
1934+ let res = self . resolver . get_lifetime_res ( id) . map_or_else (
1935+ || {
1936+ hir:: LifetimeKind :: Error (
1937+ self . tcx . dcx ( ) . span_delayed_bug ( ident. span , "unresolved lifetime" ) ,
1938+ )
1939+ } ,
1940+ |res| match res {
1941+ LifetimeRes :: Param { param, .. } => hir:: LifetimeKind :: Param ( param) ,
1942+ LifetimeRes :: Fresh { param, .. } => {
1943+ assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1944+ let param = self . local_def_id ( param) ;
1945+ hir:: LifetimeKind :: Param ( param)
1946+ }
1947+ LifetimeRes :: Infer => {
1948+ assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1949+ hir:: LifetimeKind :: Infer
1950+ }
1951+ LifetimeRes :: Static { .. } => {
1952+ assert ! ( matches!( ident. name, kw:: StaticLifetime | kw:: UnderscoreLifetime ) ) ;
1953+ hir:: LifetimeKind :: Static
1954+ }
1955+ LifetimeRes :: Error ( guar) => hir:: LifetimeKind :: Error ( guar) ,
1956+ LifetimeRes :: ElidedAnchor { .. } => {
1957+ panic ! ( "Unexpected `ElidedAnchar` {:?} at {:?}" , ident, ident. span) ;
1958+ }
1959+ } ,
1960+ ) ;
19581961
19591962 debug ! ( ?res) ;
19601963 self . arena . alloc ( hir:: Lifetime :: new (
0 commit comments