@@ -923,7 +923,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
923
923
}
924
924
} ) ;
925
925
match lifetime. name {
926
- LifetimeName :: Implicit => {
926
+ LifetimeName :: Implicit | hir :: LifetimeName :: ImplicitMissing => {
927
927
// For types like `dyn Foo`, we should
928
928
// generate a special form of elided.
929
929
span_bug ! ( ty. span, "object-lifetime-default expected, not implicit" , ) ;
@@ -3057,9 +3057,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
3057
3057
let error = loop {
3058
3058
match * scope {
3059
3059
// Do not assign any resolution, it will be inferred.
3060
- Scope :: Body { .. } => return ,
3060
+ Scope :: Body { .. } => break Ok ( ( ) ) ,
3061
3061
3062
- Scope :: Root => break None ,
3062
+ Scope :: Root => break Err ( None ) ,
3063
3063
3064
3064
Scope :: Binder { s, ref lifetimes, scope_type, .. } => {
3065
3065
// collect named lifetimes for suggestions
@@ -3086,15 +3086,15 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
3086
3086
3087
3087
self . insert_lifetime ( lifetime_ref, lifetime) ;
3088
3088
}
3089
- return ;
3089
+ break Ok ( ( ) ) ;
3090
3090
}
3091
3091
3092
3092
Scope :: Elision { elide : Elide :: Exact ( l) , .. } => {
3093
3093
let lifetime = l. shifted ( late_depth) ;
3094
3094
for lifetime_ref in lifetime_refs {
3095
3095
self . insert_lifetime ( lifetime_ref, lifetime) ;
3096
3096
}
3097
- return ;
3097
+ break Ok ( ( ) ) ;
3098
3098
}
3099
3099
3100
3100
Scope :: Elision { elide : Elide :: Error ( ref e) , ref s, .. } => {
@@ -3119,10 +3119,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
3119
3119
_ => break ,
3120
3120
}
3121
3121
}
3122
- break Some ( & e[ ..] ) ;
3122
+ break Err ( Some ( & e[ ..] ) ) ;
3123
3123
}
3124
3124
3125
- Scope :: Elision { elide : Elide :: Forbid , .. } => break None ,
3125
+ Scope :: Elision { elide : Elide :: Forbid , .. } => break Err ( None ) ,
3126
3126
3127
3127
Scope :: ObjectLifetimeDefault { s, .. }
3128
3128
| Scope :: Supertrait { s, .. }
@@ -3132,6 +3132,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
3132
3132
}
3133
3133
} ;
3134
3134
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
+
3135
3143
// If we specifically need the `scope_for_path` map, then we're in the
3136
3144
// diagnostic pass and we don't want to emit more errors.
3137
3145
if self . map . scope_for_path . is_some ( ) {
@@ -3274,7 +3282,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
3274
3282
) )
3275
3283
. emit ( ) ;
3276
3284
}
3277
- hir:: LifetimeName :: Param ( _) | hir:: LifetimeName :: Implicit => {
3285
+ hir:: LifetimeName :: Param ( _)
3286
+ | hir:: LifetimeName :: Implicit
3287
+ | hir:: LifetimeName :: ImplicitMissing => {
3278
3288
self . resolve_lifetime_ref ( lt) ;
3279
3289
}
3280
3290
hir:: LifetimeName :: ImplicitObjectLifetimeDefault => {
0 commit comments