@@ -710,7 +710,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
710710 /// const HELLO_WORLD: &str = "Hello, world!";
711711 /// static ZEROES: &[u8] = &[0, 0, 0];
712712 /// ```
713- allow_elided_static : bool ,
713+ warn_elided_static : bool ,
714714}
715715
716716/// Walks the whole crate in DFS order, visiting each item, resolving names as it goes.
@@ -1356,7 +1356,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
13561356 in_func_body : false ,
13571357 lifetime_uses : Default :: default ( ) ,
13581358 crate_node_id : krate. id ,
1359- allow_elided_static : false ,
1359+ warn_elided_static : true ,
13601360 }
13611361 }
13621362
@@ -1568,10 +1568,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
15681568 }
15691569
15701570 #[ instrument( level = "debug" , skip( self ) ) ]
1571- fn visit_ty_allow_elided_static ( & mut self , ty : & ' ast Ty ) {
1572- self . allow_elided_static = true ;
1571+ fn visit_ty_do_not_warn_elided_static ( & mut self , ty : & ' ast Ty ) {
1572+ self . warn_elided_static = false ;
15731573 self . visit_ty ( ty) ;
1574- self . allow_elided_static = false ;
1574+ self . warn_elided_static = true ;
15751575 }
15761576
15771577 #[ instrument( level = "debug" , skip( self ) ) ]
@@ -2069,7 +2069,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
20692069 debug_assert_eq ! ( id, missing. id) ;
20702070 match res {
20712071 LifetimeRes :: Static => {
2072- if ! self . allow_elided_static {
2072+ if self . warn_elided_static {
20732073 self . r . lint_buffer . buffer_lint (
20742074 lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
20752075 missing. id_if_not_fake_or ( self . crate_node_id ) ,
@@ -2620,7 +2620,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
26202620 ItemKind :: Static ( box ast:: StaticItem { ref ty, ref expr, .. } ) => {
26212621 self . with_static_rib ( def_kind, |this| {
26222622 this. with_lifetime_rib ( LifetimeRibKind :: Elided ( LifetimeRes :: Static ) , |this| {
2623- this. visit_ty_allow_elided_static ( ty) ;
2623+ this. visit_ty_do_not_warn_elided_static ( ty) ;
26242624 } ) ;
26252625 if let Some ( expr) = expr {
26262626 // We already forbid generic params because of the above item rib,
@@ -2651,7 +2651,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
26512651
26522652 this. with_lifetime_rib (
26532653 LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
2654- |this| this. visit_ty_allow_elided_static ( ty) ,
2654+ |this| this. visit_ty_do_not_warn_elided_static ( ty) ,
26552655 ) ;
26562656
26572657 if let Some ( expr) = expr {
0 commit comments