@@ -313,7 +313,7 @@ enum LifetimeRibKind {
313313
314314 /// Resolves elided lifetimes to `'static`, but gives a warning that this behavior
315315 /// is a bug and will be reverted soon.
316- AnonymousWarnToStatic ( NodeId ) ,
316+ AnonymousWarn ( NodeId ) ,
317317
318318 /// Signal we cannot find which should be the anonymous lifetime.
319319 ElisionFailure ,
@@ -1154,7 +1154,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
11541154 }
11551155 LifetimeRibKind :: AnonymousCreateParameter { .. }
11561156 | LifetimeRibKind :: AnonymousReportError
1157- | LifetimeRibKind :: AnonymousWarnToStatic ( _)
1157+ | LifetimeRibKind :: AnonymousWarn ( _)
11581158 | LifetimeRibKind :: Elided ( _)
11591159 | LifetimeRibKind :: ElisionFailure
11601160 | LifetimeRibKind :: ConcreteAnonConst ( _)
@@ -1522,7 +1522,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
15221522 // lifetime would be illegal.
15231523 LifetimeRibKind :: Item
15241524 | LifetimeRibKind :: AnonymousReportError
1525- | LifetimeRibKind :: AnonymousWarnToStatic ( _)
1525+ | LifetimeRibKind :: AnonymousWarn ( _)
15261526 | LifetimeRibKind :: ElisionFailure => Some ( LifetimeUseSet :: Many ) ,
15271527 // An anonymous lifetime is legal here, and bound to the right
15281528 // place, go ahead.
@@ -1585,7 +1585,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
15851585 | LifetimeRibKind :: Generics { .. }
15861586 | LifetimeRibKind :: ElisionFailure
15871587 | LifetimeRibKind :: AnonymousReportError
1588- | LifetimeRibKind :: AnonymousWarnToStatic ( _) => { }
1588+ | LifetimeRibKind :: AnonymousWarn ( _) => { }
15891589 }
15901590 }
15911591
@@ -1625,8 +1625,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
16251625 self . record_lifetime_res ( lifetime. id , res, elision_candidate) ;
16261626 return ;
16271627 }
1628- LifetimeRibKind :: AnonymousWarnToStatic ( node_id) => {
1629- self . record_lifetime_res ( lifetime. id , LifetimeRes :: Static , elision_candidate) ;
1628+ LifetimeRibKind :: AnonymousWarn ( node_id) => {
16301629 let msg = if elided {
16311630 "`&` without an explicit lifetime name cannot be used here"
16321631 } else {
@@ -1642,7 +1641,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
16421641 span : lifetime. ident . span ,
16431642 } ,
16441643 ) ;
1645- return ;
16461644 }
16471645 LifetimeRibKind :: AnonymousReportError => {
16481646 let ( msg, note) = if elided {
@@ -1840,7 +1838,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
18401838 // impl Foo for std::cell::Ref<u32> // note lack of '_
18411839 // async fn foo(_: std::cell::Ref<u32>) { ... }
18421840 LifetimeRibKind :: AnonymousCreateParameter { report_in_path : true , .. }
1843- | LifetimeRibKind :: AnonymousWarnToStatic ( _) => {
1841+ | LifetimeRibKind :: AnonymousWarn ( _) => {
18441842 let sess = self . r . tcx . sess ;
18451843 let mut err = rustc_errors:: struct_span_err!(
18461844 sess,
@@ -2936,33 +2934,30 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
29362934 kind : LifetimeBinderKind :: ConstItem ,
29372935 } ,
29382936 |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+ ) ;
29532949
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+ } ) ;
29662961 } ,
29672962 ) ;
29682963 }
0 commit comments