@@ -1319,7 +1319,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1319
1319
| PathSource :: Struct
1320
1320
| PathSource :: TupleStruct ( ..) => false ,
1321
1321
} ;
1322
- let mut error = true ;
1323
1322
let mut res = LifetimeRes :: Error ;
1324
1323
for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
1325
1324
match rib. kind {
@@ -1339,15 +1338,14 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1339
1338
// lifetime. Instead, we simply create an implicit lifetime, which will be checked
1340
1339
// later, at which point a suitable error will be emitted.
1341
1340
LifetimeRibKind :: AnonymousPassThrough ( binder) => {
1342
- error = false ;
1343
1341
res = LifetimeRes :: Anonymous { binder, elided : true } ;
1344
1342
break ;
1345
1343
}
1346
1344
LifetimeRibKind :: AnonymousReportError | LifetimeRibKind :: Item => {
1347
1345
// FIXME(cjgillot) This resolution is wrong, but this does not matter
1348
- // since these cases are erroneous anyway.
1346
+ // since these cases are erroneous anyway. Lifetime resolution should
1347
+ // emit a "missing lifetime specifier" diagnostic.
1349
1348
res = LifetimeRes :: Anonymous { binder : DUMMY_NODE_ID , elided : true } ;
1350
- error = false ;
1351
1349
break ;
1352
1350
}
1353
1351
_ => { }
@@ -1377,7 +1375,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1377
1375
// originating from macros, since the segment's span might be from a macro arg.
1378
1376
segment. ident . span . find_ancestor_inside ( path_span) . unwrap_or ( path_span)
1379
1377
} ;
1380
- if error {
1378
+ if let LifetimeRes :: Error = res {
1381
1379
let sess = self . r . session ;
1382
1380
let mut err = rustc_errors:: struct_span_err!(
1383
1381
sess,
0 commit comments