1- use rustc_data_structures :: sso :: SsoHashMap ;
1+ use rustc_type_ir :: data_structures :: HashMap ;
22use rustc_type_ir:: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
33use rustc_type_ir:: inherent:: * ;
44use rustc_type_ir:: visit:: TypeVisitableExt ;
1616 I : Interner ,
1717{
1818 delegate : & ' a D ,
19- cache : SsoHashMap < I :: Ty , I :: Ty > ,
19+ cache : HashMap < I :: Ty , I :: Ty > ,
2020}
2121
2222impl < ' a , D : SolverDelegate > EagerResolver < ' a , D > {
@@ -31,11 +31,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolv
3131 }
3232
3333 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 ( ) {
3935 ty:: Infer ( ty:: TyVar ( vid) ) => {
4036 let resolved = self . delegate . opportunistic_resolve_ty_var ( vid) ;
4137 if t != resolved && resolved. has_infer ( ) {
@@ -48,15 +44,17 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolv
4844 ty:: Infer ( ty:: FloatVar ( vid) ) => self . delegate . opportunistic_resolve_float_var ( vid) ,
4945 _ => {
5046 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
5253 } else {
5354 t
5455 }
5556 }
56- } ;
57-
58- assert ! ( self . cache. insert( t, res) . is_none( ) ) ;
59- res
57+ }
6058 }
6159
6260 fn fold_region ( & mut self , r : I :: Region ) -> I :: Region {
0 commit comments