@@ -1726,7 +1726,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17261726 if ident. name == kw:: StaticLifetime {
17271727 self . record_lifetime_res (
17281728 lifetime. id ,
1729- LifetimeRes :: Static { suppress_elision_warning : false } ,
1729+ LifetimeRes :: Static ,
17301730 LifetimeElisionCandidate :: Named ,
17311731 ) ;
17321732 return ;
@@ -1874,8 +1874,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18741874 if lifetimes_in_scope. is_empty ( ) {
18751875 self . record_lifetime_res (
18761876 lifetime. id ,
1877- // We are inside a const item, so do not warn.
1878- LifetimeRes :: Static { suppress_elision_warning : true } ,
1877+ LifetimeRes :: Static ,
18791878 elision_candidate,
18801879 ) ;
18811880 return ;
@@ -2222,47 +2221,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22222221 panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
22232222 }
22242223
2225- match candidate {
2226- LifetimeElisionCandidate :: Missing ( missing @ MissingLifetime { .. } ) => {
2227- debug_assert_eq ! ( id, missing. id) ;
2228- match res {
2229- LifetimeRes :: Static { suppress_elision_warning } => {
2230- if !suppress_elision_warning {
2231- self . r . lint_buffer . buffer_lint (
2232- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2233- missing. id_for_lint ,
2234- missing. span ,
2235- BuiltinLintDiag :: ElidedNamedLifetimes {
2236- elided : ( missing. span , missing. kind ) ,
2237- resolution : lint:: ElidedLifetimeResolution :: Static ,
2238- } ,
2239- ) ;
2240- }
2241- }
2242- LifetimeRes :: Param { param, binder : _ } => {
2243- let tcx = self . r . tcx ( ) ;
2244- self . r . lint_buffer . buffer_lint (
2245- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2246- missing. id_for_lint ,
2247- missing. span ,
2248- BuiltinLintDiag :: ElidedNamedLifetimes {
2249- elided : ( missing. span , missing. kind ) ,
2250- resolution : lint:: ElidedLifetimeResolution :: Param (
2251- tcx. item_name ( param. into ( ) ) ,
2252- tcx. source_span ( param) ,
2253- ) ,
2254- } ,
2255- ) ;
2256- }
2257- LifetimeRes :: Fresh { .. }
2258- | LifetimeRes :: Infer
2259- | LifetimeRes :: Error
2260- | LifetimeRes :: ElidedAnchor { .. } => { }
2261- }
2262- }
2263- LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2264- }
2265-
22662224 match res {
22672225 LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
22682226 if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
@@ -2785,14 +2743,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
27852743 ..
27862744 } ) => {
27872745 self . with_static_rib ( def_kind, |this| {
2788- this. with_lifetime_rib (
2789- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2790- suppress_elision_warning : true ,
2791- } ) ,
2792- |this| {
2793- this. visit_ty ( ty) ;
2794- } ,
2795- ) ;
2746+ this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2747+ this. visit_ty ( ty) ;
2748+ } ) ;
27962749 if let Some ( expr) = expr {
27972750 // We already forbid generic params because of the above item rib,
27982751 // so it doesn't matter whether this is a trivial constant.
@@ -2829,9 +2782,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
28292782 this. visit_generics ( generics) ;
28302783
28312784 this. with_lifetime_rib (
2832- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2833- suppress_elision_warning : true ,
2834- } ) ,
2785+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
28352786 |this| this. visit_ty ( ty) ,
28362787 ) ;
28372788
0 commit comments