@@ -1785,7 +1785,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17851785 self . emit_non_static_lt_in_const_param_ty_error ( lifetime) ;
17861786 self . record_lifetime_res (
17871787 lifetime. id ,
1788- LifetimeRes :: Error ,
1788+ LifetimeRes :: Error { undeclared : None } ,
17891789 LifetimeElisionCandidate :: Ignore ,
17901790 ) ;
17911791 return ;
@@ -1794,7 +1794,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17941794 self . emit_forbidden_non_static_lifetime_error ( cause, lifetime) ;
17951795 self . record_lifetime_res (
17961796 lifetime. id ,
1797- LifetimeRes :: Error ,
1797+ LifetimeRes :: Error { undeclared : None } ,
17981798 LifetimeElisionCandidate :: Ignore ,
17991799 ) ;
18001800 return ;
@@ -1812,8 +1812,12 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18121812 let outer_res = lifetime_rib_iter
18131813 . find_map ( |rib| rib. bindings . get_key_value ( & normalized_ident) . map ( |( & outer, _) | outer) ) ;
18141814
1815- self . emit_undeclared_lifetime_error ( lifetime, outer_res) ;
1816- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Error , LifetimeElisionCandidate :: Named ) ;
1815+ let guar = self . emit_undeclared_lifetime_error ( lifetime, outer_res) ;
1816+ self . record_lifetime_res (
1817+ lifetime. id ,
1818+ LifetimeRes :: Error { undeclared : Some ( guar) } ,
1819+ LifetimeElisionCandidate :: Named ,
1820+ ) ;
18171821 }
18181822
18191823 #[ instrument( level = "debug" , skip( self ) ) ]
@@ -1953,7 +1957,11 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
19531957 span : lifetime. ident . span ,
19541958 } ) ;
19551959 } ;
1956- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Error , elision_candidate) ;
1960+ self . record_lifetime_res (
1961+ lifetime. id ,
1962+ LifetimeRes :: Error { undeclared : None } ,
1963+ elision_candidate,
1964+ ) ;
19571965 return ;
19581966 }
19591967 LifetimeRibKind :: Elided ( res) => {
@@ -1962,7 +1970,11 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
19621970 }
19631971 LifetimeRibKind :: ElisionFailure => {
19641972 self . diag_metadata . current_elision_failures . push ( missing_lifetime) ;
1965- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Error , elision_candidate) ;
1973+ self . record_lifetime_res (
1974+ lifetime. id ,
1975+ LifetimeRes :: Error { undeclared : None } ,
1976+ elision_candidate,
1977+ ) ;
19661978 return ;
19671979 }
19681980 LifetimeRibKind :: Item => break ,
@@ -1973,7 +1985,11 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
19731985 }
19741986 }
19751987 }
1976- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Error , elision_candidate) ;
1988+ self . record_lifetime_res (
1989+ lifetime. id ,
1990+ LifetimeRes :: Error { undeclared : None } ,
1991+ elision_candidate,
1992+ ) ;
19771993 self . report_missing_lifetime_specifiers ( vec ! [ missing_lifetime] , None ) ;
19781994 }
19791995
@@ -2231,7 +2247,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22312247 for id in node_ids {
22322248 self . record_lifetime_res (
22332249 id,
2234- LifetimeRes :: Error ,
2250+ LifetimeRes :: Error { undeclared : None } ,
22352251 LifetimeElisionCandidate :: Named ,
22362252 ) ;
22372253 }
@@ -2267,7 +2283,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22672283 for id in node_ids {
22682284 self . record_lifetime_res (
22692285 id,
2270- LifetimeRes :: Error ,
2286+ LifetimeRes :: Error { undeclared : None } ,
22712287 LifetimeElisionCandidate :: Ignore ,
22722288 ) ;
22732289 }
@@ -2281,7 +2297,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22812297 for id in node_ids {
22822298 self . record_lifetime_res (
22832299 id,
2284- LifetimeRes :: Error ,
2300+ LifetimeRes :: Error { undeclared : None } ,
22852301 LifetimeElisionCandidate :: Ignore ,
22862302 ) ;
22872303 }
@@ -2329,7 +2345,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
23292345 candidates. push ( ( res, candidate) ) ;
23302346 }
23312347 }
2332- LifetimeRes :: Infer | LifetimeRes :: Error | LifetimeRes :: ElidedAnchor { .. } => { }
2348+ LifetimeRes :: Infer | LifetimeRes :: Error { .. } | LifetimeRes :: ElidedAnchor { .. } => { }
23332349 }
23342350 }
23352351
@@ -3030,7 +3046,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
30303046 {
30313047 diagnostics:: signal_lifetime_shadowing ( self . r . tcx . sess , original, param. ident ) ;
30323048 // Record lifetime res, so lowering knows there is something fishy.
3033- self . record_lifetime_param ( param. id , LifetimeRes :: Error ) ;
3049+ self . record_lifetime_param ( param. id , LifetimeRes :: Error { undeclared : None } ) ;
30343050 continue ;
30353051 }
30363052
@@ -3042,7 +3058,10 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
30423058 let rib = match param. kind {
30433059 GenericParamKind :: Lifetime => {
30443060 // Record lifetime res, so lowering knows there is something fishy.
3045- self . record_lifetime_param ( param. id , LifetimeRes :: Error ) ;
3061+ self . record_lifetime_param (
3062+ param. id ,
3063+ LifetimeRes :: Error { undeclared : None } ,
3064+ ) ;
30463065 continue ;
30473066 }
30483067 GenericParamKind :: Type { .. } => & mut function_type_rib,
@@ -3076,7 +3095,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
30763095 . create_err ( errors:: UnderscoreLifetimeIsReserved { span : param. ident . span } )
30773096 . emit_unless_delay ( is_raw_underscore_lifetime) ;
30783097 // Record lifetime res, so lowering knows there is something fishy.
3079- self . record_lifetime_param ( param. id , LifetimeRes :: Error ) ;
3098+ self . record_lifetime_param ( param. id , LifetimeRes :: Error { undeclared : None } ) ;
30803099 continue ;
30813100 }
30823101
@@ -3086,7 +3105,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
30863105 lifetime : param. ident ,
30873106 } ) ;
30883107 // Record lifetime res, so lowering knows there is something fishy.
3089- self . record_lifetime_param ( param. id , LifetimeRes :: Error ) ;
3108+ self . record_lifetime_param ( param. id , LifetimeRes :: Error { undeclared : None } ) ;
30903109 continue ;
30913110 }
30923111
0 commit comments