@@ -710,7 +710,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
710
710
/// const HELLO_WORLD: &str = "Hello, world!";
711
711
/// static ZEROES: &[u8] = &[0, 0, 0];
712
712
/// ```
713
- allow_elided_static : bool ,
713
+ warn_elided_static : bool ,
714
714
}
715
715
716
716
/// 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> {
1356
1356
in_func_body : false ,
1357
1357
lifetime_uses : Default :: default ( ) ,
1358
1358
crate_node_id : krate. id ,
1359
- allow_elided_static : false ,
1359
+ warn_elided_static : true ,
1360
1360
}
1361
1361
}
1362
1362
@@ -1568,10 +1568,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1568
1568
}
1569
1569
1570
1570
#[ 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 ;
1573
1573
self . visit_ty ( ty) ;
1574
- self . allow_elided_static = false ;
1574
+ self . warn_elided_static = true ;
1575
1575
}
1576
1576
1577
1577
#[ instrument( level = "debug" , skip( self ) ) ]
@@ -2069,7 +2069,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2069
2069
debug_assert_eq ! ( id, missing. id) ;
2070
2070
match res {
2071
2071
LifetimeRes :: Static => {
2072
- if ! self . allow_elided_static {
2072
+ if self . warn_elided_static {
2073
2073
self . r . lint_buffer . buffer_lint (
2074
2074
lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2075
2075
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> {
2620
2620
ItemKind :: Static ( box ast:: StaticItem { ref ty, ref expr, .. } ) => {
2621
2621
self . with_static_rib ( def_kind, |this| {
2622
2622
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) ;
2624
2624
} ) ;
2625
2625
if let Some ( expr) = expr {
2626
2626
// 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> {
2651
2651
2652
2652
this. with_lifetime_rib (
2653
2653
LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
2654
- |this| this. visit_ty_allow_elided_static ( ty) ,
2654
+ |this| this. visit_ty_do_not_warn_elided_static ( ty) ,
2655
2655
) ;
2656
2656
2657
2657
if let Some ( expr) = expr {
0 commit comments