Skip to content

Commit 221d715

Browse files
committed
TyClosure no longer needs to use freshen_closure_like
All the data is now part of its type.
1 parent 1f13e13 commit 221d715

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/librustc/infer/freshen.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
103103
self.infcx.tcx.mk_infer(freshener(index))
104104
}
105105

106-
fn freshen_closure_like<M, C>(&mut self,
106+
fn freshen_generator_like<M, C>(&mut self,
107107
def_id: DefId,
108108
substs: ty::ClosureSubsts<'tcx>,
109109
t: Ty<'tcx>,
@@ -249,19 +249,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
249249
t
250250
}
251251

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-
263252
ty::TyGenerator(def_id, substs, interior) => {
264-
self.freshen_closure_like(
253+
self.freshen_generator_like(
265254
def_id, substs, t,
266255
|this| {
267256
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> {
300289
ty::TyProjection(..) |
301290
ty::TyForeign(..) |
302291
ty::TyParam(..) |
292+
ty::TyClosure(..) |
303293
ty::TyAnon(..) => {
304294
t.super_fold_with(self)
305295
}

0 commit comments

Comments
 (0)