@@ -557,7 +557,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
557
557
/// They will be used to determine the correct lifetime for the fn return type.
558
558
/// The `LifetimeElisionCandidate` is used for diagnostics, to suggest introducing named
559
559
/// lifetimes.
560
- lifetime_elision_candidates : Option < FxIndexMap < LifetimeRes , LifetimeElisionCandidate > > ,
560
+ lifetime_elision_candidates : Option < Vec < ( LifetimeRes , LifetimeElisionCandidate ) > > ,
561
561
562
562
/// The trait that the current context can refer to.
563
563
current_trait_ref : Option < ( Module < ' a > , TraitRef ) > ,
@@ -1819,7 +1819,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1819
1819
match res {
1820
1820
LifetimeRes :: Param { .. } | LifetimeRes :: Fresh { .. } | LifetimeRes :: Static => {
1821
1821
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
1822
- candidates. insert ( res, candidate) ;
1822
+ candidates. push ( ( res, candidate) ) ;
1823
1823
}
1824
1824
}
1825
1825
LifetimeRes :: Infer | LifetimeRes :: Error | LifetimeRes :: ElidedAnchor { .. } => { }
@@ -1928,8 +1928,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1928
1928
1929
1929
// We do not have a `self` candidate, look at the full list.
1930
1930
let all_candidates = all_candidates. unwrap ( ) ;
1931
- if all_candidates . len ( ) == 1 {
1932
- Ok ( * all_candidates . first ( ) . unwrap ( ) . 0 )
1931
+ if let [ ( res , _ ) ] = & all_candidates [ .. ] {
1932
+ Ok ( * res )
1933
1933
} else {
1934
1934
let all_candidates = all_candidates
1935
1935
. into_iter ( )
@@ -2411,7 +2411,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
2411
2411
// Do not account for the parameters we just bound for function lifetime elision.
2412
2412
if let Some ( ref mut candidates) = self . lifetime_elision_candidates {
2413
2413
for ( _, res) in function_lifetime_rib. bindings . values ( ) {
2414
- candidates. remove ( res) ;
2414
+ candidates. retain ( | ( r , _ ) | r != res) ;
2415
2415
}
2416
2416
}
2417
2417
0 commit comments