@@ -58,14 +58,9 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
58
58
}
59
59
}
60
60
61
- fn freshen_ty < F > (
62
- & mut self ,
63
- opt_ty : Option < Ty < ' tcx > > ,
64
- key : ty:: InferTy ,
65
- freshener : F ,
66
- ) -> Ty < ' tcx >
61
+ fn freshen_ty < F > ( & mut self , opt_ty : Option < Ty < ' tcx > > , key : ty:: InferTy , mk_fresh : F ) -> Ty < ' tcx >
67
62
where
68
- F : FnOnce ( u32 ) -> ty :: InferTy ,
63
+ F : FnOnce ( u32 ) -> Ty < ' tcx > ,
69
64
{
70
65
if let Some ( ty) = opt_ty {
71
66
return ty. fold_with ( self ) ;
@@ -76,7 +71,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
76
71
Entry :: Vacant ( entry) => {
77
72
let index = self . ty_freshen_count ;
78
73
self . ty_freshen_count += 1 ;
79
- let t = self . infcx . tcx . mk_ty_infer ( freshener ( index) ) ;
74
+ let t = mk_fresh ( index) ;
80
75
entry. insert ( t) ;
81
76
t
82
77
}
@@ -204,7 +199,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
204
199
match v {
205
200
ty:: TyVar ( v) => {
206
201
let opt_ty = self . infcx . inner . borrow_mut ( ) . type_variables ( ) . probe ( v) . known ( ) ;
207
- Some ( self . freshen_ty ( opt_ty, ty:: TyVar ( v) , ty :: FreshTy ) )
202
+ Some ( self . freshen_ty ( opt_ty, ty:: TyVar ( v) , |n| self . infcx . tcx . mk_fresh_ty ( n ) ) )
208
203
}
209
204
210
205
ty:: IntVar ( v) => Some (
@@ -216,7 +211,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
216
211
. probe_value ( v)
217
212
. map ( |v| v. to_type ( self . infcx . tcx ) ) ,
218
213
ty:: IntVar ( v) ,
219
- ty :: FreshIntTy ,
214
+ |n| self . infcx . tcx . mk_fresh_int_ty ( n ) ,
220
215
) ,
221
216
) ,
222
217
@@ -229,7 +224,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
229
224
. probe_value ( v)
230
225
. map ( |v| v. to_type ( self . infcx . tcx ) ) ,
231
226
ty:: FloatVar ( v) ,
232
- ty :: FreshFloatTy ,
227
+ |n| self . infcx . tcx . mk_fresh_float_ty ( n ) ,
233
228
) ,
234
229
) ,
235
230
0 commit comments