@@ -880,7 +880,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
880880
881881 ( hir:: ParamName :: Fresh , hir:: LifetimeParamKind :: Elided ( kind) )
882882 }
883- LifetimeRes :: Static { .. } | LifetimeRes :: Error { .. } => return None ,
883+ LifetimeRes :: Static { .. } | LifetimeRes :: Error ( .. ) => return None ,
884884 res => panic ! (
885885 "Unexpected lifetime resolution {:?} for {:?} at {:?}" ,
886886 res, ident, ident. span
@@ -1934,27 +1934,29 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19341934 syntax : LifetimeSyntax ,
19351935 ) -> & ' hir hir:: Lifetime {
19361936 let res =
1937- self . resolver . get_lifetime_res ( id) . unwrap_or ( LifetimeRes :: Error { undeclared : None } ) ;
1938- let res = match res {
1939- LifetimeRes :: Param { param, .. } => hir:: LifetimeKind :: Param ( param) ,
1940- LifetimeRes :: Fresh { param, .. } => {
1941- assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1942- let param = self . local_def_id ( param) ;
1943- hir:: LifetimeKind :: Param ( param)
1944- }
1945- LifetimeRes :: Infer => {
1946- assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1947- hir:: LifetimeKind :: Infer
1948- }
1949- LifetimeRes :: Static { .. } => {
1950- assert ! ( matches!( ident. name, kw:: StaticLifetime | kw:: UnderscoreLifetime ) ) ;
1951- hir:: LifetimeKind :: Static
1952- }
1953- LifetimeRes :: Error { undeclared } => hir:: LifetimeKind :: Error { undeclared } ,
1954- LifetimeRes :: ElidedAnchor { .. } => {
1955- panic ! ( "Unexpected `ElidedAnchar` {:?} at {:?}" , ident, ident. span) ;
1956- }
1957- } ;
1937+ self . resolver . get_lifetime_res ( id) . map_or (
1938+ hir:: LifetimeKind :: NotFound ,
1939+ |res| match res {
1940+ LifetimeRes :: Param { param, .. } => hir:: LifetimeKind :: Param ( param) ,
1941+ LifetimeRes :: Fresh { param, .. } => {
1942+ assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1943+ let param = self . local_def_id ( param) ;
1944+ hir:: LifetimeKind :: Param ( param)
1945+ }
1946+ LifetimeRes :: Infer => {
1947+ assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1948+ hir:: LifetimeKind :: Infer
1949+ }
1950+ LifetimeRes :: Static { .. } => {
1951+ assert ! ( matches!( ident. name, kw:: StaticLifetime | kw:: UnderscoreLifetime ) ) ;
1952+ hir:: LifetimeKind :: Static
1953+ }
1954+ LifetimeRes :: Error ( guar) => hir:: LifetimeKind :: Error ( guar) ,
1955+ LifetimeRes :: ElidedAnchor { .. } => {
1956+ panic ! ( "Unexpected `ElidedAnchar` {:?} at {:?}" , ident, ident. span) ;
1957+ }
1958+ } ,
1959+ ) ;
19581960
19591961 debug ! ( ?res) ;
19601962 self . arena . alloc ( hir:: Lifetime :: new (
@@ -2017,7 +2019,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20172019 // AST resolution emitted an error on those parameters, so we lower them using
20182020 // `ParamName::Error`.
20192021 let ident = self . lower_ident ( param. ident ) ;
2020- let param_name = if let Some ( LifetimeRes :: Error { .. } ) =
2022+ let param_name = if let Some ( LifetimeRes :: Error ( .. ) ) =
20212023 self . resolver . get_lifetime_res ( param. id )
20222024 {
20232025 ParamName :: Error ( ident)
0 commit comments