@@ -1319,7 +1319,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13191319 | PathSource :: Struct
13201320 | PathSource :: TupleStruct ( ..) => false ,
13211321 } ;
1322- let mut error = false ;
1322+ let mut error = true ;
1323+ let mut res = LifetimeRes :: Error ;
13231324 for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
13241325 match rib. kind {
13251326 // 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> {
13291330 // impl Foo for std::cell::Ref<u32> // note lack of '_
13301331 // async fn foo(_: std::cell::Ref<u32>) { ... }
13311332 LifetimeRibKind :: AnonymousCreateParameter ( _) => {
1332- error = true ;
13331333 break ;
13341334 }
13351335 // `PassThrough` is the normal case.
@@ -1338,19 +1338,22 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13381338 // `PathSegment`, for which there is no associated `'_` or `&T` with no explicit
13391339 // lifetime. Instead, we simply create an implicit lifetime, which will be checked
13401340 // 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+ }
13441353 _ => { }
13451354 }
13461355 }
13471356
1348- let res = if error {
1349- LifetimeRes :: Error
1350- } else {
1351- LifetimeRes :: Anonymous { binder : segment_id, elided : true }
1352- } ;
1353-
13541357 let node_ids = self . r . next_node_ids ( expected_lifetimes) ;
13551358 self . record_lifetime_res (
13561359 segment_id,
0 commit comments