diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-11-08 17:33:29 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-11-18 07:47:38 -0500 |
| commit | 7c609eb090b42d590507d87895af9fc1e28eae11 (patch) | |
| tree | 40ebec2ba699c4b68cda41e4e5ea339da9765c40 /src | |
| parent | e6fca1d5655350a93bda4a1532800adad3bb96b7 (diff) | |
| download | rust-7c609eb090b42d590507d87895af9fc1e28eae11.tar.gz rust-7c609eb090b42d590507d87895af9fc1e28eae11.zip | |
`TyClosure` no longer needs to use `freshen_closure_like`
All the data is now part of its type.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/infer/freshen.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index c4727c820b1..b1ee6d7a298 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -103,7 +103,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> { self.infcx.tcx.mk_infer(freshener(index)) } - fn freshen_closure_like<M, C>(&mut self, + fn freshen_generator_like<M, C>(&mut self, def_id: DefId, substs: ty::ClosureSubsts<'tcx>, t: Ty<'tcx>, @@ -249,19 +249,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { t } - ty::TyClosure(def_id, substs) => { - self.freshen_closure_like( - def_id, substs, t, - |this| { - let closure_sig = this.infcx.fn_sig(def_id); - (tcx.mk_fn_ptr(closure_sig.fold_with(this)), tcx.types.char) - }, - |substs| tcx.mk_closure(def_id, ty::ClosureSubsts { substs }) - ) - } - ty::TyGenerator(def_id, substs, interior) => { - self.freshen_closure_like( + self.freshen_generator_like( def_id, substs, t, |this| { 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> { ty::TyProjection(..) | ty::TyForeign(..) | ty::TyParam(..) | + ty::TyClosure(..) | ty::TyAnon(..) => { t.super_fold_with(self) } |
