@@ -1701,7 +1701,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17011701 if ident. name == kw:: StaticLifetime {
17021702 self . record_lifetime_res (
17031703 lifetime. id ,
1704- LifetimeRes :: Static { suppress_elision_warning : false } ,
1704+ LifetimeRes :: Static ,
17051705 LifetimeElisionCandidate :: Named ,
17061706 ) ;
17071707 return ;
@@ -1849,8 +1849,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18491849 if lifetimes_in_scope. is_empty ( ) {
18501850 self . record_lifetime_res (
18511851 lifetime. id ,
1852- // We are inside a const item, so do not warn.
1853- LifetimeRes :: Static { suppress_elision_warning : true } ,
1852+ LifetimeRes :: Static ,
18541853 elision_candidate,
18551854 ) ;
18561855 return ;
@@ -2197,47 +2196,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
21972196 panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
21982197 }
21992198
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-
22412199 match res {
22422200 LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static { .. } => {
22432201 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> {
27552713 ..
27562714 } ) => {
27572715 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+ } ) ;
27662719 if let Some ( expr) = expr {
27672720 // We already forbid generic params because of the above item rib,
27682721 // 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> {
27992752 this. visit_generics ( generics) ;
28002753
28012754 this. with_lifetime_rib (
2802- LifetimeRibKind :: Elided ( LifetimeRes :: Static {
2803- suppress_elision_warning : true ,
2804- } ) ,
2755+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
28052756 |this| this. visit_ty ( ty) ,
28062757 ) ;
28072758
0 commit comments