@@ -923,7 +923,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
923923 }
924924 } ) ;
925925 match lifetime. name {
926- LifetimeName :: Implicit => {
926+ LifetimeName :: Implicit | hir :: LifetimeName :: ImplicitMissing => {
927927 // For types like `dyn Foo`, we should
928928 // generate a special form of elided.
929929 span_bug ! ( ty. span, "object-lifetime-default expected, not implicit" , ) ;
@@ -3057,9 +3057,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
30573057 let error = loop {
30583058 match * scope {
30593059 // Do not assign any resolution, it will be inferred.
3060- Scope :: Body { .. } => return ,
3060+ Scope :: Body { .. } => break Ok ( ( ) ) ,
30613061
3062- Scope :: Root => break None ,
3062+ Scope :: Root => break Err ( None ) ,
30633063
30643064 Scope :: Binder { s, ref lifetimes, scope_type, .. } => {
30653065 // collect named lifetimes for suggestions
@@ -3086,15 +3086,15 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
30863086
30873087 self . insert_lifetime ( lifetime_ref, lifetime) ;
30883088 }
3089- return ;
3089+ break Ok ( ( ) ) ;
30903090 }
30913091
30923092 Scope :: Elision { elide : Elide :: Exact ( l) , .. } => {
30933093 let lifetime = l. shifted ( late_depth) ;
30943094 for lifetime_ref in lifetime_refs {
30953095 self . insert_lifetime ( lifetime_ref, lifetime) ;
30963096 }
3097- return ;
3097+ break Ok ( ( ) ) ;
30983098 }
30993099
31003100 Scope :: Elision { elide : Elide :: Error ( ref e) , ref s, .. } => {
@@ -3119,10 +3119,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
31193119 _ => break ,
31203120 }
31213121 }
3122- break Some ( & e[ ..] ) ;
3122+ break Err ( Some ( & e[ ..] ) ) ;
31233123 }
31243124
3125- Scope :: Elision { elide : Elide :: Forbid , .. } => break None ,
3125+ Scope :: Elision { elide : Elide :: Forbid , .. } => break Err ( None ) ,
31263126
31273127 Scope :: ObjectLifetimeDefault { s, .. }
31283128 | Scope :: Supertrait { s, .. }
@@ -3132,6 +3132,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
31323132 }
31333133 } ;
31343134
3135+ let error = match error {
3136+ Ok ( ( ) ) => {
3137+ self . report_elided_lifetime_in_ty ( lifetime_refs) ;
3138+ return ;
3139+ }
3140+ Err ( error) => error,
3141+ } ;
3142+
31353143 // If we specifically need the `scope_for_path` map, then we're in the
31363144 // diagnostic pass and we don't want to emit more errors.
31373145 if self . map . scope_for_path . is_some ( ) {
@@ -3274,7 +3282,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
32743282 ) )
32753283 . emit ( ) ;
32763284 }
3277- hir:: LifetimeName :: Param ( _) | hir:: LifetimeName :: Implicit => {
3285+ hir:: LifetimeName :: Param ( _)
3286+ | hir:: LifetimeName :: Implicit
3287+ | hir:: LifetimeName :: ImplicitMissing => {
32783288 self . resolve_lifetime_ref ( lt) ;
32793289 }
32803290 hir:: LifetimeName :: ImplicitObjectLifetimeDefault => {
0 commit comments