@@ -1706,7 +1706,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17061706 if ident. name == kw:: StaticLifetime {
17071707 self . record_lifetime_res (
17081708 lifetime. id ,
1709- LifetimeRes :: Static { suppress_elision_warning : false } ,
1709+ LifetimeRes :: Static ,
17101710 LifetimeElisionCandidate :: Named ,
17111711 ) ;
17121712 return ;
@@ -1854,8 +1854,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18541854 if lifetimes_in_scope. is_empty ( ) {
18551855 self . record_lifetime_res (
18561856 lifetime. id ,
1857- // We are inside a const item, so do not warn.
1858- LifetimeRes :: Static { suppress_elision_warning : true } ,
1857+ LifetimeRes :: Static ,
18591858 elision_candidate,
18601859 ) ;
18611860 return ;
@@ -2202,47 +2201,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22022201 panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
22032202 }
22042203
2205- match candidate {
2206- LifetimeElisionCandidate :: Missing ( missing @ MissingLifetime { .. } ) => {
2207- debug_assert_eq ! ( id, missing. id) ;
2208- match res {
2209- LifetimeRes :: Static { suppress_elision_warning } => {
2210- if !suppress_elision_warning {
2211- self . r . lint_buffer . buffer_lint (
2212- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2213- missing. id_for_lint ,
2214- missing. span ,
2215- BuiltinLintDiag :: ElidedNamedLifetimes {
2216- elided : ( missing. span , missing. kind ) ,
2217- resolution : lint:: ElidedLifetimeResolution :: Static ,
2218- } ,
2219- ) ;
2220- }
2221- }
2222- LifetimeRes :: Param { param, binder : _ } => {
2223- let tcx = self . r . tcx ( ) ;
2224- self . r . lint_buffer . buffer_lint (
2225- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2226- missing. id_for_lint ,
2227- missing. span ,
2228- BuiltinLintDiag :: ElidedNamedLifetimes {
2229- elided : ( missing. span , missing. kind ) ,
2230- resolution : lint:: ElidedLifetimeResolution :: Param (
2231- tcx. item_name ( param. into ( ) ) ,
2232- tcx. source_span ( param) ,
2233- ) ,
2234- } ,
2235- ) ;
2236- }
2237- LifetimeRes :: Fresh { .. }
2238- | LifetimeRes :: Infer
2239- | LifetimeRes :: Error
2240- | LifetimeRes :: ElidedAnchor { .. } => { }
2241- }
2242- }
2243- LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2244- }
2245-
22462204 match res {
22472205 LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
22482206 if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
@@ -2760,14 +2718,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
27602718 ..
27612719 } ) => {
27622720 self . with_static_rib ( def_kind, |this| {
2763- this. with_lifetime_rib (
2764- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2765- suppress_elision_warning : true ,
2766- } ) ,
2767- |this| {
2768- this. visit_ty ( ty) ;
2769- } ,
2770- ) ;
2721+ this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2722+ this. visit_ty ( ty) ;
2723+ } ) ;
27712724 if let Some ( expr) = expr {
27722725 // We already forbid generic params because of the above item rib,
27732726 // so it doesn't matter whether this is a trivial constant.
@@ -2804,9 +2757,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
28042757 this. visit_generics ( generics) ;
28052758
28062759 this. with_lifetime_rib (
2807- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2808- suppress_elision_warning : true ,
2809- } ) ,
2760+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
28102761 |this| this. visit_ty ( ty) ,
28112762 ) ;
28122763
0 commit comments