@@ -225,9 +225,6 @@ enum LifetimeRibKind {
225225 /// Create a new anonymous region parameter and reference that.
226226 AnonymousCreateParameter ( NodeId ) ,
227227
228- /// Give a hard error when generic lifetime arguments are elided.
229- ReportElidedInPath ,
230-
231228 /// Give a hard error when either `&` or `'_` is written. Used to
232229 /// rule out things like `where T: Foo<'_>`. Does not imply an
233230 /// error on default object bounds (e.g., `Box<dyn Foo>`).
@@ -743,10 +740,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
743740 this. with_lifetime_rib (
744741 LifetimeRibKind :: AnonymousCreateParameter ( fn_id) ,
745742 |this| {
746- this. with_lifetime_rib ( LifetimeRibKind :: ReportElidedInPath , |this| {
747- // Add each argument to the rib.
748- this. resolve_params ( & declaration. inputs )
749- } ) ;
743+ // Add each argument to the rib.
744+ this. resolve_params ( & declaration. inputs )
750745 } ,
751746 ) ;
752747
@@ -1397,7 +1392,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13971392 path_span : Span ,
13981393 ) {
13991394 let proj_start = path. len ( ) - partial_res. unresolved_segments ( ) ;
1400- ' segment : for ( i, segment) in path. iter ( ) . enumerate ( ) {
1395+ for ( i, segment) in path. iter ( ) . enumerate ( ) {
14011396 if segment. has_lifetime_args {
14021397 continue ;
14031398 }
@@ -1464,32 +1459,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
14641459
14651460 for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
14661461 match rib. kind {
1467- // We error here because we don't want to support deprecated impl elision in
1468- // new features like impl elision and `async fn`,
1469- LifetimeRibKind :: ReportElidedInPath => {
1470- let sess = self . r . session ;
1471- let mut err = rustc_errors:: struct_span_err!(
1472- sess,
1473- path_span,
1474- E0726 ,
1475- "implicit elided lifetime not allowed here"
1476- ) ;
1477- rustc_errors:: add_elided_lifetime_in_path_suggestion (
1478- sess. source_map ( ) ,
1479- & mut err,
1480- expected_lifetimes,
1481- path_span,
1482- !segment. has_generic_args ,
1483- elided_lifetime_span,
1484- ) ;
1485- err. note ( "assuming a `'static` lifetime..." ) ;
1486- err. emit ( ) ;
1487- for i in 0 ..expected_lifetimes {
1488- let id = node_ids. start . plus ( i) ;
1489- self . record_lifetime_res ( id, LifetimeRes :: Error ) ;
1490- }
1491- continue ' segment;
1492- }
14931462 LifetimeRibKind :: AnonymousCreateParameter ( binder) => {
14941463 let ident = Ident :: new ( kw:: UnderscoreLifetime , elided_lifetime_span) ;
14951464 for i in 0 ..expected_lifetimes {
@@ -2096,14 +2065,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
20962065 let mut new_id = None ;
20972066 if let Some ( trait_ref) = opt_trait_ref {
20982067 let path: Vec < _ > = Segment :: from_path ( & trait_ref. path ) ;
2099- let res = self . with_lifetime_rib ( LifetimeRibKind :: ReportElidedInPath , |this| {
2100- this. smart_resolve_path_fragment (
2101- None ,
2102- & path,
2103- PathSource :: Trait ( AliasPossibility :: No ) ,
2104- Finalize :: new ( trait_ref. ref_id , trait_ref. path . span ) ,
2105- )
2106- } ) ;
2068+ let res = self . smart_resolve_path_fragment (
2069+ None ,
2070+ & path,
2071+ PathSource :: Trait ( AliasPossibility :: No ) ,
2072+ Finalize :: new ( trait_ref. ref_id , trait_ref. path . span ) ,
2073+ ) ;
21072074 if let Some ( def_id) = res. base_res ( ) . opt_def_id ( ) {
21082075 new_id = Some ( def_id) ;
21092076 new_val = Some ( ( self . r . expect_module ( def_id) , trait_ref. clone ( ) ) ) ;
@@ -2156,16 +2123,14 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
21562123 let res =
21572124 Res :: SelfTy { trait_ : trait_id, alias_to : Some ( ( item_def_id, false ) ) } ;
21582125 this. with_self_rib ( res, |this| {
2159- this. with_lifetime_rib ( LifetimeRibKind :: ReportElidedInPath , |this| {
2160- if let Some ( trait_ref) = opt_trait_reference. as_ref ( ) {
2161- // Resolve type arguments in the trait path.
2162- visit:: walk_trait_ref ( this, trait_ref) ;
2163- }
2164- // Resolve the self type.
2165- this. visit_ty ( self_type) ;
2166- // Resolve the generic parameters.
2167- this. visit_generics ( generics) ;
2168- } ) ;
2126+ if let Some ( trait_ref) = opt_trait_reference. as_ref ( ) {
2127+ // Resolve type arguments in the trait path.
2128+ visit:: walk_trait_ref ( this, trait_ref) ;
2129+ }
2130+ // Resolve the self type.
2131+ this. visit_ty ( self_type) ;
2132+ // Resolve the generic parameters.
2133+ this. visit_generics ( generics) ;
21692134
21702135 // Resolve the items within the impl.
21712136 this. with_lifetime_rib ( LifetimeRibKind :: AnonymousPassThrough ( item_id, false ) ,
0 commit comments