@@ -103,7 +103,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
103
103
self . infcx . tcx . mk_infer ( freshener ( index) )
104
104
}
105
105
106
- fn freshen_closure_like < M , C > ( & mut self ,
106
+ fn freshen_generator_like < M , C > ( & mut self ,
107
107
def_id : DefId ,
108
108
substs : ty:: ClosureSubsts < ' tcx > ,
109
109
t : Ty < ' tcx > ,
@@ -249,19 +249,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
249
249
t
250
250
}
251
251
252
- ty:: TyClosure ( def_id, substs) => {
253
- self . freshen_closure_like (
254
- def_id, substs, t,
255
- |this| {
256
- let closure_sig = this. infcx . fn_sig ( def_id) ;
257
- ( tcx. mk_fn_ptr ( closure_sig. fold_with ( this) ) , tcx. types . char )
258
- } ,
259
- |substs| tcx. mk_closure ( def_id, ty:: ClosureSubsts { substs } )
260
- )
261
- }
262
-
263
252
ty:: TyGenerator ( def_id, substs, interior) => {
264
- self . freshen_closure_like (
253
+ self . freshen_generator_like (
265
254
def_id, substs, t,
266
255
|this| {
267
256
let gen_sig = this. infcx . generator_sig ( def_id) . unwrap ( ) ;
@@ -300,6 +289,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
300
289
ty:: TyProjection ( ..) |
301
290
ty:: TyForeign ( ..) |
302
291
ty:: TyParam ( ..) |
292
+ ty:: TyClosure ( ..) |
303
293
ty:: TyAnon ( ..) => {
304
294
t. super_fold_with ( self )
305
295
}
0 commit comments