1
- use rustc_data_structures :: sso :: SsoHashMap ;
1
+ use rustc_type_ir :: data_structures :: HashMap ;
2
2
use rustc_type_ir:: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
3
3
use rustc_type_ir:: inherent:: * ;
4
4
use rustc_type_ir:: visit:: TypeVisitableExt ;
16
16
I : Interner ,
17
17
{
18
18
delegate : & ' a D ,
19
- cache : SsoHashMap < I :: Ty , I :: Ty > ,
19
+ cache : HashMap < I :: Ty , I :: Ty > ,
20
20
}
21
21
22
22
impl < ' a , D : SolverDelegate > EagerResolver < ' a , D > {
@@ -31,11 +31,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolv
31
31
}
32
32
33
33
fn fold_ty ( & mut self , t : I :: Ty ) -> I :: Ty {
34
- if let Some ( & ty) = self . cache . get ( & t) {
35
- return ty;
36
- }
37
-
38
- let res = match t. kind ( ) {
34
+ match t. kind ( ) {
39
35
ty:: Infer ( ty:: TyVar ( vid) ) => {
40
36
let resolved = self . delegate . opportunistic_resolve_ty_var ( vid) ;
41
37
if t != resolved && resolved. has_infer ( ) {
@@ -48,15 +44,17 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolv
48
44
ty:: Infer ( ty:: FloatVar ( vid) ) => self . delegate . opportunistic_resolve_float_var ( vid) ,
49
45
_ => {
50
46
if t. has_infer ( ) {
51
- t. super_fold_with ( self )
47
+ if let Some ( & ty) = self . cache . get ( & t) {
48
+ return ty;
49
+ }
50
+ let res = t. super_fold_with ( self ) ;
51
+ assert ! ( self . cache. insert( t, res) . is_none( ) ) ;
52
+ res
52
53
} else {
53
54
t
54
55
}
55
56
}
56
- } ;
57
-
58
- assert ! ( self . cache. insert( t, res) . is_none( ) ) ;
59
- res
57
+ }
60
58
}
61
59
62
60
fn fold_region ( & mut self , r : I :: Region ) -> I :: Region {
0 commit comments