@@ -225,9 +225,6 @@ enum LifetimeRibKind {
225
225
/// Create a new anonymous region parameter and reference that.
226
226
AnonymousCreateParameter ( NodeId ) ,
227
227
228
- /// Give a hard error when generic lifetime arguments are elided.
229
- ReportElidedInPath ,
230
-
231
228
/// Give a hard error when either `&` or `'_` is written. Used to
232
229
/// rule out things like `where T: Foo<'_>`. Does not imply an
233
230
/// error on default object bounds (e.g., `Box<dyn Foo>`).
@@ -743,10 +740,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
743
740
this. with_lifetime_rib (
744
741
LifetimeRibKind :: AnonymousCreateParameter ( fn_id) ,
745
742
|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 )
750
745
} ,
751
746
) ;
752
747
@@ -1397,7 +1392,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1397
1392
path_span : Span ,
1398
1393
) {
1399
1394
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 ( ) {
1401
1396
if segment. has_lifetime_args {
1402
1397
continue ;
1403
1398
}
@@ -1464,32 +1459,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1464
1459
1465
1460
for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
1466
1461
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
- }
1493
1462
LifetimeRibKind :: AnonymousCreateParameter ( binder) => {
1494
1463
let ident = Ident :: new ( kw:: UnderscoreLifetime , elided_lifetime_span) ;
1495
1464
for i in 0 ..expected_lifetimes {
@@ -2096,14 +2065,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
2096
2065
let mut new_id = None ;
2097
2066
if let Some ( trait_ref) = opt_trait_ref {
2098
2067
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
+ ) ;
2107
2074
if let Some ( def_id) = res. base_res ( ) . opt_def_id ( ) {
2108
2075
new_id = Some ( def_id) ;
2109
2076
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> {
2156
2123
let res =
2157
2124
Res :: SelfTy { trait_ : trait_id, alias_to : Some ( ( item_def_id, false ) ) } ;
2158
2125
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) ;
2169
2134
2170
2135
// Resolve the items within the impl.
2171
2136
this. with_lifetime_rib ( LifetimeRibKind :: AnonymousPassThrough ( item_id, false ) ,
0 commit comments