@@ -1319,7 +1319,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13191319 | PathSource :: Struct
13201320 | PathSource :: TupleStruct ( ..) => false ,
13211321 } ;
1322- let mut error = true ;
13231322 let mut res = LifetimeRes :: Error ;
13241323 for rib in self . lifetime_ribs . iter ( ) . rev ( ) {
13251324 match rib. kind {
@@ -1339,15 +1338,14 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13391338 // lifetime. Instead, we simply create an implicit lifetime, which will be checked
13401339 // later, at which point a suitable error will be emitted.
13411340 LifetimeRibKind :: AnonymousPassThrough ( binder) => {
1342- error = false ;
13431341 res = LifetimeRes :: Anonymous { binder, elided : true } ;
13441342 break ;
13451343 }
13461344 LifetimeRibKind :: AnonymousReportError | LifetimeRibKind :: Item => {
13471345 // 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.
13491348 res = LifetimeRes :: Anonymous { binder : DUMMY_NODE_ID , elided : true } ;
1350- error = false ;
13511349 break ;
13521350 }
13531351 _ => { }
@@ -1377,7 +1375,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13771375 // originating from macros, since the segment's span might be from a macro arg.
13781376 segment. ident . span . find_ancestor_inside ( path_span) . unwrap_or ( path_span)
13791377 } ;
1380- if error {
1378+ if let LifetimeRes :: Error = res {
13811379 let sess = self . r . session ;
13821380 let mut err = rustc_errors:: struct_span_err!(
13831381 sess,
0 commit comments