@@ -1729,7 +1729,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1729
1729
if ident. name == kw:: StaticLifetime {
1730
1730
self . record_lifetime_res (
1731
1731
lifetime. id ,
1732
- LifetimeRes :: Static { suppress_elision_warning : false } ,
1732
+ LifetimeRes :: Static ,
1733
1733
LifetimeElisionCandidate :: Named ,
1734
1734
) ;
1735
1735
return ;
@@ -1877,8 +1877,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1877
1877
if lifetimes_in_scope. is_empty ( ) {
1878
1878
self . record_lifetime_res (
1879
1879
lifetime. id ,
1880
- // We are inside a const item, so do not warn.
1881
- LifetimeRes :: Static { suppress_elision_warning : true } ,
1880
+ LifetimeRes :: Static ,
1882
1881
elision_candidate,
1883
1882
) ;
1884
1883
return ;
@@ -2225,47 +2224,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2225
2224
panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
2226
2225
}
2227
2226
2228
- match candidate {
2229
- LifetimeElisionCandidate :: Missing ( missing @ MissingLifetime { .. } ) => {
2230
- debug_assert_eq ! ( id, missing. id) ;
2231
- match res {
2232
- LifetimeRes :: Static { suppress_elision_warning } => {
2233
- if !suppress_elision_warning {
2234
- self . r . lint_buffer . buffer_lint (
2235
- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2236
- missing. id_for_lint ,
2237
- missing. span ,
2238
- BuiltinLintDiag :: ElidedNamedLifetimes {
2239
- elided : ( missing. span , missing. kind ) ,
2240
- resolution : lint:: ElidedLifetimeResolution :: Static ,
2241
- } ,
2242
- ) ;
2243
- }
2244
- }
2245
- LifetimeRes :: Param { param, binder : _ } => {
2246
- let tcx = self . r . tcx ( ) ;
2247
- self . r . lint_buffer . buffer_lint (
2248
- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2249
- missing. id_for_lint ,
2250
- missing. span ,
2251
- BuiltinLintDiag :: ElidedNamedLifetimes {
2252
- elided : ( missing. span , missing. kind ) ,
2253
- resolution : lint:: ElidedLifetimeResolution :: Param (
2254
- tcx. item_name ( param. into ( ) ) ,
2255
- tcx. source_span ( param) ,
2256
- ) ,
2257
- } ,
2258
- ) ;
2259
- }
2260
- LifetimeRes :: Fresh { .. }
2261
- | LifetimeRes :: Infer
2262
- | LifetimeRes :: Error
2263
- | LifetimeRes :: ElidedAnchor { .. } => { }
2264
- }
2265
- }
2266
- LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2267
- }
2268
-
2269
2227
match res {
2270
2228
LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
2271
2229
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
@@ -2788,14 +2746,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2788
2746
..
2789
2747
} ) => {
2790
2748
self . with_static_rib ( def_kind, |this| {
2791
- this. with_lifetime_rib (
2792
- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2793
- suppress_elision_warning : true ,
2794
- } ) ,
2795
- |this| {
2796
- this. visit_ty ( ty) ;
2797
- } ,
2798
- ) ;
2749
+ this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2750
+ this. visit_ty ( ty) ;
2751
+ } ) ;
2799
2752
if let Some ( expr) = expr {
2800
2753
// We already forbid generic params because of the above item rib,
2801
2754
// so it doesn't matter whether this is a trivial constant.
@@ -2832,9 +2785,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2832
2785
this. visit_generics ( generics) ;
2833
2786
2834
2787
this. with_lifetime_rib (
2835
- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2836
- suppress_elision_warning : true ,
2837
- } ) ,
2788
+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
2838
2789
|this| this. visit_ty ( ty) ,
2839
2790
) ;
2840
2791
0 commit comments