Factor write_ty out of check_expr_closure

This commit is contained in:
Andrew Cann 2016-08-18 23:30:11 +08:00
parent 144b8cf5db
commit 21720641dc
2 changed files with 3 additions and 4 deletions

View File

@ -70,8 +70,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.parameter_environment.free_substs,
upvar_tys);
let ty = self.write_ty(expr.id, closure_type);
let fn_sig = self.tcx.liberate_late_bound_regions(
self.tcx.region_maps.call_site_extent(expr.id, body.id), &fn_ty.sig);
let fn_sig =
@ -94,7 +92,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
None => { }
}
ty
closure_type
}
fn deduce_expectations_from_expected_type(&self, expected_ty: Ty<'tcx>)

View File

@ -3531,7 +3531,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.write_ty(expr.id, result_ty)
}
hir::ExprClosure(capture, ref decl, ref body, _) => {
self.check_expr_closure(expr, capture, &decl, &body, expected)
let ty = self.check_expr_closure(expr, capture, &decl, &body, expected);
self.write_ty(id, ty)
}
hir::ExprBlock(ref b) => {
self.check_block_with_expected(&b, expected);