@@ -342,11 +342,6 @@ enum LifetimeRibKind {
342342 /// error on default object bounds (e.g., `Box<dyn Foo>`).
343343 AnonymousReportError ,
344344
345- /// Resolves elided lifetimes to `'static` if there are no other lifetimes in scope,
346- /// otherwise give a warning that the previous behavior of introducing a new early-bound
347- /// lifetime is a bug and will be removed (if `emit_lint` is enabled).
348- StaticIfNoLifetimeInScope { emit_lint : bool } ,
349-
350345 /// Signal we cannot find which should be the anonymous lifetime.
351346 ElisionFailure ,
352347
@@ -1373,7 +1368,6 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
13731368 }
13741369 LifetimeRibKind :: AnonymousCreateParameter { .. }
13751370 | LifetimeRibKind :: AnonymousReportError
1376- | LifetimeRibKind :: StaticIfNoLifetimeInScope { .. }
13771371 | LifetimeRibKind :: ImplTrait
13781372 | LifetimeRibKind :: Elided ( _)
13791373 | LifetimeRibKind :: ElisionFailure
@@ -1779,7 +1773,6 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
17791773 // lifetime would be illegal.
17801774 LifetimeRibKind :: Item
17811775 | LifetimeRibKind :: AnonymousReportError
1782- | LifetimeRibKind :: StaticIfNoLifetimeInScope { .. }
17831776 | LifetimeRibKind :: ElisionFailure => Some ( LifetimeUseSet :: Many ) ,
17841777 // An anonymous lifetime is legal here, and bound to the right
17851778 // place, go ahead.
@@ -1843,8 +1836,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18431836 | LifetimeRibKind :: Generics { .. }
18441837 | LifetimeRibKind :: ElisionFailure
18451838 | LifetimeRibKind :: AnonymousReportError
1846- | LifetimeRibKind :: ImplTrait
1847- | LifetimeRibKind :: StaticIfNoLifetimeInScope { .. } => { }
1839+ | LifetimeRibKind :: ImplTrait => { }
18481840 }
18491841 }
18501842
@@ -1883,31 +1875,6 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18831875 self . record_lifetime_use ( lifetime. id , res, elision_candidate) ;
18841876 return ;
18851877 }
1886- LifetimeRibKind :: StaticIfNoLifetimeInScope { emit_lint } => {
1887- let mut lifetimes_in_scope = vec ! [ ] ;
1888- for rib in self . lifetime_ribs [ ..i] . iter ( ) . rev ( ) {
1889- lifetimes_in_scope. extend ( rib. bindings . iter ( ) . map ( |( ident, _) | ident. span ) ) ;
1890- // Consider any anonymous lifetimes, too
1891- if let LifetimeRibKind :: AnonymousCreateParameter { binder, .. } = rib. kind
1892- && let Some ( extra) = self . r . extra_lifetime_params_map . get ( & binder)
1893- {
1894- lifetimes_in_scope. extend ( extra. iter ( ) . map ( |( ident, _, _) | ident. span ) ) ;
1895- }
1896- if let LifetimeRibKind :: Item = rib. kind {
1897- break ;
1898- }
1899- }
1900- if lifetimes_in_scope. is_empty ( ) {
1901- self . record_lifetime_use (
1902- lifetime. id ,
1903- LifetimeRes :: Static ,
1904- elision_candidate,
1905- ) ;
1906- return ;
1907- } else if emit_lint {
1908- break ;
1909- }
1910- }
19111878 LifetimeRibKind :: AnonymousReportError => {
19121879 let guar = if elided {
19131880 let suggestion = self . lifetime_ribs [ i..] . iter ( ) . rev ( ) . find_map ( |rib| {
@@ -2257,8 +2224,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
22572224 //
22582225 // impl Foo for std::cell::Ref<u32> // note lack of '_
22592226 // async fn foo(_: std::cell::Ref<u32>) { ... }
2260- LifetimeRibKind :: AnonymousCreateParameter { report_in_path : true , .. }
2261- | LifetimeRibKind :: StaticIfNoLifetimeInScope { .. } => {
2227+ LifetimeRibKind :: AnonymousCreateParameter { report_in_path : true , .. } => {
22622228 let sess = self . r . tcx . sess ;
22632229 let subdiag = elided_lifetime_in_path_suggestion (
22642230 sess. source_map ( ) ,
@@ -3331,7 +3297,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
33313297 generics. span ,
33323298 |this| {
33333299 this. with_lifetime_rib (
3334- LifetimeRibKind :: StaticIfNoLifetimeInScope { emit_lint : false } ,
3300+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
33353301 |this| {
33363302 this. visit_generics ( generics) ;
33373303 if rhs_kind. is_type_const ( )
@@ -3547,10 +3513,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
35473513 generics. span ,
35483514 |this| {
35493515 this. with_lifetime_rib (
3550- LifetimeRibKind :: StaticIfNoLifetimeInScope {
3551- // In impls, it's not a hard error yet due to backcompat.
3552- emit_lint : true ,
3553- } ,
3516+ LifetimeRibKind :: Elided ( LifetimeRes :: Static ) ,
35543517 |this| {
35553518 // If this is a trait impl, ensure the const
35563519 // exists in trait
0 commit comments