@@ -3076,50 +3076,54 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
30763076 scope = s;
30773077 }
30783078
3079- Scope :: Elision { ref elide, ref s, .. } => {
3080- let lifetime = match * elide {
3081- Elide :: FreshLateAnon ( named_late_bound_vars, ref counter) => {
3082- for lifetime_ref in lifetime_refs {
3083- let lifetime = Region :: late_anon ( named_late_bound_vars, counter)
3084- . shifted ( late_depth) ;
3085-
3086- self . insert_lifetime ( lifetime_ref, lifetime) ;
3087- }
3088- return ;
3089- }
3090- Elide :: Exact ( l) => l. shifted ( late_depth) ,
3091- Elide :: Error ( ref e) => {
3092- let mut scope = s;
3093- loop {
3094- match scope {
3095- Scope :: Binder { ref lifetimes, s, .. } => {
3096- // Collect named lifetimes for suggestions.
3097- for name in lifetimes. keys ( ) {
3098- if let hir:: ParamName :: Plain ( name) = name {
3099- lifetime_names. insert ( name. name ) ;
3100- lifetime_spans. push ( name. span ) ;
3101- }
3102- }
3103- scope = s;
3104- }
3105- Scope :: ObjectLifetimeDefault { ref s, .. }
3106- | Scope :: Elision { ref s, .. }
3107- | Scope :: TraitRefBoundary { ref s, .. } => {
3108- scope = s;
3079+ Scope :: Elision {
3080+ elide : Elide :: FreshLateAnon ( named_late_bound_vars, ref counter) ,
3081+ ..
3082+ } => {
3083+ for lifetime_ref in lifetime_refs {
3084+ let lifetime =
3085+ Region :: late_anon ( named_late_bound_vars, counter) . shifted ( late_depth) ;
3086+
3087+ self . insert_lifetime ( lifetime_ref, lifetime) ;
3088+ }
3089+ return ;
3090+ }
3091+
3092+ Scope :: Elision { elide : Elide :: Exact ( l) , .. } => {
3093+ let lifetime = l. shifted ( late_depth) ;
3094+ for lifetime_ref in lifetime_refs {
3095+ self . insert_lifetime ( lifetime_ref, lifetime) ;
3096+ }
3097+ return ;
3098+ }
3099+
3100+ Scope :: Elision { elide : Elide :: Error ( ref e) , ref s, .. } => {
3101+ let mut scope = s;
3102+ loop {
3103+ match scope {
3104+ Scope :: Binder { ref lifetimes, s, .. } => {
3105+ // Collect named lifetimes for suggestions.
3106+ for name in lifetimes. keys ( ) {
3107+ if let hir:: ParamName :: Plain ( name) = name {
3108+ lifetime_names. insert ( name. name ) ;
3109+ lifetime_spans. push ( name. span ) ;
31093110 }
3110- _ => break ,
31113111 }
3112+ scope = s;
31123113 }
3113- break Some ( & e[ ..] ) ;
3114+ Scope :: ObjectLifetimeDefault { ref s, .. }
3115+ | Scope :: Elision { ref s, .. }
3116+ | Scope :: TraitRefBoundary { ref s, .. } => {
3117+ scope = s;
3118+ }
3119+ _ => break ,
31143120 }
3115- Elide :: Forbid => break None ,
3116- } ;
3117- for lifetime_ref in lifetime_refs {
3118- self . insert_lifetime ( lifetime_ref, lifetime) ;
31193121 }
3120- return ;
3122+ break Some ( & e [ .. ] ) ;
31213123 }
31223124
3125+ Scope :: Elision { elide : Elide :: Forbid , .. } => break None ,
3126+
31233127 Scope :: ObjectLifetimeDefault { s, .. }
31243128 | Scope :: Supertrait { s, .. }
31253129 | Scope :: TraitRefBoundary { s, .. } => {
0 commit comments