@@ -313,7 +313,7 @@ enum LifetimeRibKind {
313
313
314
314
/// Resolves elided lifetimes to `'static`, but gives a warning that this behavior
315
315
/// is a bug and will be reverted soon.
316
- AnonymousWarnToStatic ( NodeId ) ,
316
+ AnonymousWarn ( NodeId ) ,
317
317
318
318
/// Signal we cannot find which should be the anonymous lifetime.
319
319
ElisionFailure ,
@@ -1154,7 +1154,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
1154
1154
}
1155
1155
LifetimeRibKind :: AnonymousCreateParameter { .. }
1156
1156
| LifetimeRibKind :: AnonymousReportError
1157
- | LifetimeRibKind :: AnonymousWarnToStatic ( _)
1157
+ | LifetimeRibKind :: AnonymousWarn ( _)
1158
1158
| LifetimeRibKind :: Elided ( _)
1159
1159
| LifetimeRibKind :: ElisionFailure
1160
1160
| LifetimeRibKind :: ConcreteAnonConst ( _)
@@ -1522,7 +1522,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1522
1522
// lifetime would be illegal.
1523
1523
LifetimeRibKind :: Item
1524
1524
| LifetimeRibKind :: AnonymousReportError
1525
- | LifetimeRibKind :: AnonymousWarnToStatic ( _)
1525
+ | LifetimeRibKind :: AnonymousWarn ( _)
1526
1526
| LifetimeRibKind :: ElisionFailure => Some ( LifetimeUseSet :: Many ) ,
1527
1527
// An anonymous lifetime is legal here, and bound to the right
1528
1528
// place, go ahead.
@@ -1585,7 +1585,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1585
1585
| LifetimeRibKind :: Generics { .. }
1586
1586
| LifetimeRibKind :: ElisionFailure
1587
1587
| LifetimeRibKind :: AnonymousReportError
1588
- | LifetimeRibKind :: AnonymousWarnToStatic ( _) => { }
1588
+ | LifetimeRibKind :: AnonymousWarn ( _) => { }
1589
1589
}
1590
1590
}
1591
1591
@@ -1625,8 +1625,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1625
1625
self . record_lifetime_res ( lifetime. id , res, elision_candidate) ;
1626
1626
return ;
1627
1627
}
1628
- LifetimeRibKind :: AnonymousWarnToStatic ( node_id) => {
1629
- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Static , elision_candidate) ;
1628
+ LifetimeRibKind :: AnonymousWarn ( node_id) => {
1630
1629
let msg = if elided {
1631
1630
"`&` without an explicit lifetime name cannot be used here"
1632
1631
} else {
@@ -1642,7 +1641,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1642
1641
span : lifetime. ident . span ,
1643
1642
} ,
1644
1643
) ;
1645
- return ;
1646
1644
}
1647
1645
LifetimeRibKind :: AnonymousReportError => {
1648
1646
let ( msg, note) = if elided {
@@ -1840,7 +1838,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
1840
1838
// impl Foo for std::cell::Ref<u32> // note lack of '_
1841
1839
// async fn foo(_: std::cell::Ref<u32>) { ... }
1842
1840
LifetimeRibKind :: AnonymousCreateParameter { report_in_path : true , .. }
1843
- | LifetimeRibKind :: AnonymousWarnToStatic ( _) => {
1841
+ | LifetimeRibKind :: AnonymousWarn ( _) => {
1844
1842
let sess = self . r . tcx . sess ;
1845
1843
let mut err = rustc_errors:: struct_span_err!(
1846
1844
sess,
@@ -2936,33 +2934,30 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2936
2934
kind : LifetimeBinderKind :: ConstItem ,
2937
2935
} ,
2938
2936
|this| {
2939
- this. with_lifetime_rib (
2940
- LifetimeRibKind :: AnonymousWarnToStatic ( item. id ) ,
2941
- |this| {
2942
- // If this is a trait impl, ensure the const
2943
- // exists in trait
2944
- this. check_trait_item (
2945
- item. id ,
2946
- item. ident ,
2947
- & item. kind ,
2948
- ValueNS ,
2949
- item. span ,
2950
- seen_trait_items,
2951
- |i, s, c| ConstNotMemberOfTrait ( i, s, c) ,
2952
- ) ;
2937
+ this. with_lifetime_rib ( LifetimeRibKind :: AnonymousWarn ( item. id ) , |this| {
2938
+ // If this is a trait impl, ensure the const
2939
+ // exists in trait
2940
+ this. check_trait_item (
2941
+ item. id ,
2942
+ item. ident ,
2943
+ & item. kind ,
2944
+ ValueNS ,
2945
+ item. span ,
2946
+ seen_trait_items,
2947
+ |i, s, c| ConstNotMemberOfTrait ( i, s, c) ,
2948
+ ) ;
2953
2949
2954
- this. visit_generics ( generics) ;
2955
- this. visit_ty ( ty) ;
2956
- if let Some ( expr) = expr {
2957
- // We allow arbitrary const expressions inside of associated consts,
2958
- // even if they are potentially not const evaluatable.
2959
- //
2960
- // Type parameters can already be used and as associated consts are
2961
- // not used as part of the type system, this is far less surprising.
2962
- this. resolve_const_body ( expr, None ) ;
2963
- }
2964
- } ,
2965
- ) ;
2950
+ this. visit_generics ( generics) ;
2951
+ this. visit_ty ( ty) ;
2952
+ if let Some ( expr) = expr {
2953
+ // We allow arbitrary const expressions inside of associated consts,
2954
+ // even if they are potentially not const evaluatable.
2955
+ //
2956
+ // Type parameters can already be used and as associated consts are
2957
+ // not used as part of the type system, this is far less surprising.
2958
+ this. resolve_const_body ( expr, None ) ;
2959
+ }
2960
+ } ) ;
2966
2961
} ,
2967
2962
) ;
2968
2963
}
0 commit comments