@@ -1707,7 +1707,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1707
1707
if ident. name == kw:: StaticLifetime {
1708
1708
self . record_lifetime_res (
1709
1709
lifetime. id ,
1710
- LifetimeRes :: Static { suppress_elision_warning : false } ,
1710
+ LifetimeRes :: Static ,
1711
1711
LifetimeElisionCandidate :: Named ,
1712
1712
) ;
1713
1713
return ;
@@ -1852,8 +1852,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1852
1852
if lifetimes_in_scope. is_empty ( ) {
1853
1853
self . record_lifetime_res (
1854
1854
lifetime. id ,
1855
- // We are inside a const item, so do not warn.
1856
- LifetimeRes :: Static { suppress_elision_warning : true } ,
1855
+ LifetimeRes :: Static ,
1857
1856
elision_candidate,
1858
1857
) ;
1859
1858
return ;
@@ -2200,47 +2199,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2200
2199
panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
2201
2200
}
2202
2201
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
-
2244
2202
match res {
2245
2203
LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
2246
2204
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> {
2756
2714
2757
2715
ItemKind :: Static ( box ast:: StaticItem { ref ty, ref expr, .. } ) => {
2758
2716
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
+ } ) ;
2767
2720
if let Some ( expr) = expr {
2768
2721
// We already forbid generic params because of the above item rib,
2769
2722
// 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> {
2792
2745
this. visit_generics ( generics) ;
2793
2746
2794
2747
this. with_lifetime_rib (
2795
- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2796
- suppress_elision_warning : true ,
2797
- } ) ,
2748
+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
2798
2749
|this| this. visit_ty ( ty) ,
2799
2750
) ;
2800
2751
0 commit comments