@@ -1707,7 +1707,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17071707 if ident. name == kw:: StaticLifetime {
17081708 self . record_lifetime_res (
17091709 lifetime. id ,
1710- LifetimeRes :: Static { suppress_elision_warning : false } ,
1710+ LifetimeRes :: Static ,
17111711 LifetimeElisionCandidate :: Named ,
17121712 ) ;
17131713 return ;
@@ -1852,8 +1852,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18521852 if lifetimes_in_scope. is_empty ( ) {
18531853 self . record_lifetime_res (
18541854 lifetime. id ,
1855- // We are inside a const item, so do not warn.
1856- LifetimeRes :: Static { suppress_elision_warning : true } ,
1855+ LifetimeRes :: Static ,
18571856 elision_candidate,
18581857 ) ;
18591858 return ;
@@ -2200,47 +2199,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22002199 panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
22012200 }
22022201
2203- match candidate {
2204- LifetimeElisionCandidate :: Missing ( missing @ MissingLifetime { .. } ) => {
2205- debug_assert_eq ! ( id, missing. id) ;
2206- match res {
2207- LifetimeRes :: Static { suppress_elision_warning } => {
2208- if !suppress_elision_warning {
2209- self . r . lint_buffer . buffer_lint (
2210- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2211- missing. id_for_lint ,
2212- missing. span ,
2213- BuiltinLintDiag :: ElidedNamedLifetimes {
2214- elided : ( missing. span , missing. kind ) ,
2215- resolution : lint:: ElidedLifetimeResolution :: Static ,
2216- } ,
2217- ) ;
2218- }
2219- }
2220- LifetimeRes :: Param { param, binder : _ } => {
2221- let tcx = self . r . tcx ( ) ;
2222- self . r . lint_buffer . buffer_lint (
2223- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2224- missing. id_for_lint ,
2225- missing. span ,
2226- BuiltinLintDiag :: ElidedNamedLifetimes {
2227- elided : ( missing. span , missing. kind ) ,
2228- resolution : lint:: ElidedLifetimeResolution :: Param (
2229- tcx. item_name ( param. into ( ) ) ,
2230- tcx. source_span ( param) ,
2231- ) ,
2232- } ,
2233- ) ;
2234- }
2235- LifetimeRes :: Fresh { .. }
2236- | LifetimeRes :: Infer
2237- | LifetimeRes :: Error
2238- | LifetimeRes :: ElidedAnchor { .. } => { }
2239- }
2240- }
2241- LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2242- }
2243-
22442202 match res {
22452203 LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
22462204 if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
@@ -2756,14 +2714,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
27562714
27572715 ItemKind :: Static ( box ast:: StaticItem { ref ty, ref expr, .. } ) => {
27582716 self . with_static_rib ( def_kind, |this| {
2759- this. with_lifetime_rib (
2760- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2761- suppress_elision_warning : true ,
2762- } ) ,
2763- |this| {
2764- this. visit_ty ( ty) ;
2765- } ,
2766- ) ;
2717+ this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2718+ this. visit_ty ( ty) ;
2719+ } ) ;
27672720 if let Some ( expr) = expr {
27682721 // We already forbid generic params because of the above item rib,
27692722 // so it doesn't matter whether this is a trivial constant.
@@ -2792,9 +2745,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
27922745 this. visit_generics ( generics) ;
27932746
27942747 this. with_lifetime_rib (
2795- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2796- suppress_elision_warning : true ,
2797- } ) ,
2748+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
27982749 |this| this. visit_ty ( ty) ,
27992750 ) ;
28002751
0 commit comments