@@ -1319,7 +1319,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1319
1319
| PathSource :: Struct
1320
1320
| PathSource :: TupleStruct ( ..) => false ,
1321
1321
} ;
1322
- let mut error = false ;
1322
+ let mut error = true ;
1323
+ let mut res = LifetimeRes :: Error ;
1323
1324
for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
1324
1325
match rib. kind {
1325
1326
// In create-parameter mode we error here because we don't want to support
@@ -1329,7 +1330,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1329
1330
// impl Foo for std::cell::Ref<u32> // note lack of '_
1330
1331
// async fn foo(_: std::cell::Ref<u32>) { ... }
1331
1332
LifetimeRibKind :: AnonymousCreateParameter ( _) => {
1332
- error = true ;
1333
1333
break ;
1334
1334
}
1335
1335
// `PassThrough` is the normal case.
@@ -1338,19 +1338,22 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1338
1338
// `PathSegment`, for which there is no associated `'_` or `&T` with no explicit
1339
1339
// lifetime. Instead, we simply create an implicit lifetime, which will be checked
1340
1340
// later, at which point a suitable error will be emitted.
1341
- LifetimeRibKind :: AnonymousPassThrough ( ..)
1342
- | LifetimeRibKind :: AnonymousReportError
1343
- | LifetimeRibKind :: Item => break ,
1341
+ LifetimeRibKind :: AnonymousPassThrough ( binder) => {
1342
+ error = false ;
1343
+ res = LifetimeRes :: Anonymous { binder, elided : true } ;
1344
+ break ;
1345
+ }
1346
+ LifetimeRibKind :: AnonymousReportError | LifetimeRibKind :: Item => {
1347
+ // FIXME(cjgillot) This resolution is wrong, but this does not matter
1348
+ // since these cases are erroneous anyway.
1349
+ res = LifetimeRes :: Anonymous { binder : DUMMY_NODE_ID , elided : true } ;
1350
+ error = false ;
1351
+ break ;
1352
+ }
1344
1353
_ => { }
1345
1354
}
1346
1355
}
1347
1356
1348
- let res = if error {
1349
- LifetimeRes :: Error
1350
- } else {
1351
- LifetimeRes :: Anonymous { binder : segment_id, elided : true }
1352
- } ;
1353
-
1354
1357
let node_ids = self . r . next_node_ids ( expected_lifetimes) ;
1355
1358
self . record_lifetime_res (
1356
1359
segment_id,
0 commit comments