@@ -565,7 +565,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
565
565
/// They will be used to determine the correct lifetime for the fn return type.
566
566
/// The `LifetimeElisionCandidate` is used for diagnostics, to suggest introducing named
567
567
/// lifetimes.
568
- lifetime_elision_candidates : Option < FxIndexMap < LifetimeRes , LifetimeElisionCandidate > > ,
568
+ lifetime_elision_candidates : Option < Vec < ( LifetimeRes , LifetimeElisionCandidate ) > > ,
569
569
570
570
/// The trait that the current context can refer to.
571
571
current_trait_ref : Option < ( Module < ' a > , TraitRef ) > ,
@@ -1799,7 +1799,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1799
1799
match res {
1800
1800
LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static => {
1801
1801
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
1802
- candidates. insert ( res, candidate) ;
1802
+ candidates. push ( ( res, candidate) ) ;
1803
1803
}
1804
1804
}
1805
1805
LifetimeRes :: Infer | LifetimeRes :: Error | LifetimeRes :: ElidedAnchor { .. } => { }
@@ -1910,8 +1910,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1910
1910
1911
1911
// We do not have a `self` candidate, look at the full list.
1912
1912
let all_candidates = all_candidates. unwrap ( ) ;
1913
- if all_candidates . len ( ) == 1 {
1914
- Ok ( * all_candidates . first ( ) . unwrap ( ) . 0 )
1913
+ if let [ ( res , _ ) ] = & all_candidates [ .. ] {
1914
+ Ok ( * res )
1915
1915
} else {
1916
1916
let all_candidates = all_candidates
1917
1917
. into_iter ( )
@@ -2391,7 +2391,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
2391
2391
// Do not account for the parameters we just bound for function lifetime elision.
2392
2392
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
2393
2393
for ( _, res) in function_lifetime_rib. bindings . values ( ) {
2394
- candidates. remove ( res) ;
2394
+ candidates. retain ( | ( r , _ ) | r != res) ;
2395
2395
}
2396
2396
}
2397
2397
0 commit comments