@@ -1701,7 +1701,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1701
1701
if ident. name == kw:: StaticLifetime {
1702
1702
self . record_lifetime_res (
1703
1703
lifetime. id ,
1704
- LifetimeRes :: Static { suppress_elision_warning : false } ,
1704
+ LifetimeRes :: Static ,
1705
1705
LifetimeElisionCandidate :: Named ,
1706
1706
) ;
1707
1707
return ;
@@ -1849,8 +1849,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1849
1849
if lifetimes_in_scope. is_empty ( ) {
1850
1850
self . record_lifetime_res (
1851
1851
lifetime. id ,
1852
- // We are inside a const item, so do not warn.
1853
- LifetimeRes :: Static { suppress_elision_warning : true } ,
1852
+ LifetimeRes :: Static ,
1854
1853
elision_candidate,
1855
1854
) ;
1856
1855
return ;
@@ -2197,47 +2196,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2197
2196
panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
2198
2197
}
2199
2198
2200
- match candidate {
2201
- LifetimeElisionCandidate :: Missing ( missing @ MissingLifetime { .. } ) => {
2202
- debug_assert_eq ! ( id, missing. id) ;
2203
- match res {
2204
- LifetimeRes :: Static { suppress_elision_warning } => {
2205
- if !suppress_elision_warning {
2206
- self . r . lint_buffer . buffer_lint (
2207
- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2208
- missing. id_for_lint ,
2209
- missing. span ,
2210
- BuiltinLintDiag :: ElidedNamedLifetimes {
2211
- elided : ( missing. span , missing. kind ) ,
2212
- resolution : lint:: ElidedLifetimeResolution :: Static ,
2213
- } ,
2214
- ) ;
2215
- }
2216
- }
2217
- LifetimeRes :: Param { param, binder : _ } => {
2218
- let tcx = self . r . tcx ( ) ;
2219
- self . r . lint_buffer . buffer_lint (
2220
- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2221
- missing. id_for_lint ,
2222
- missing. span ,
2223
- BuiltinLintDiag :: ElidedNamedLifetimes {
2224
- elided : ( missing. span , missing. kind ) ,
2225
- resolution : lint:: ElidedLifetimeResolution :: Param (
2226
- tcx. item_name ( param. into ( ) ) ,
2227
- tcx. source_span ( param) ,
2228
- ) ,
2229
- } ,
2230
- ) ;
2231
- }
2232
- LifetimeRes :: Fresh { .. }
2233
- | LifetimeRes :: Infer
2234
- | LifetimeRes :: Error
2235
- | LifetimeRes :: ElidedAnchor { .. } => { }
2236
- }
2237
- }
2238
- LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2239
- }
2240
-
2241
2199
match res {
2242
2200
LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
2243
2201
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
@@ -2755,14 +2713,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2755
2713
..
2756
2714
} ) => {
2757
2715
self . with_static_rib ( def_kind, |this| {
2758
- this. with_lifetime_rib (
2759
- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2760
- suppress_elision_warning : true ,
2761
- } ) ,
2762
- |this| {
2763
- this. visit_ty ( ty) ;
2764
- } ,
2765
- ) ;
2716
+ this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2717
+ this. visit_ty ( ty) ;
2718
+ } ) ;
2766
2719
if let Some ( expr) = expr {
2767
2720
// We already forbid generic params because of the above item rib,
2768
2721
// so it doesn't matter whether this is a trivial constant.
@@ -2799,9 +2752,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2799
2752
this. visit_generics ( generics) ;
2800
2753
2801
2754
this. with_lifetime_rib (
2802
- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2803
- suppress_elision_warning : true ,
2804
- } ) ,
2755
+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
2805
2756
|this| this. visit_ty ( ty) ,
2806
2757
) ;
2807
2758
0 commit comments