Skip to content

Commit 2172064

Browse files
committed
Factor write_ty out of check_expr_closure
1 parent 144b8cf commit 2172064

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/librustc_typeck/check/closure.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
7070
self.parameter_environment.free_substs,
7171
upvar_tys);
7272

73-
let ty = self.write_ty(expr.id, closure_type);
74-
7573
let fn_sig = self.tcx.liberate_late_bound_regions(
7674
self.tcx.region_maps.call_site_extent(expr.id, body.id), &fn_ty.sig);
7775
let fn_sig =
@@ -94,7 +92,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
9492
None => { }
9593
}
9694

97-
ty
95+
closure_type
9896
}
9997

10098
fn deduce_expectations_from_expected_type(&self, expected_ty: Ty<'tcx>)

src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3531,7 +3531,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
35313531
self.write_ty(expr.id, result_ty)
35323532
}
35333533
hir::ExprClosure(capture, ref decl, ref body, _) => {
3534-
self.check_expr_closure(expr, capture, &decl, &body, expected)
3534+
let ty = self.check_expr_closure(expr, capture, &decl, &body, expected);
3535+
self.write_ty(id, ty)
35353536
}
35363537
hir::ExprBlock(ref b) => {
35373538
self.check_block_with_expected(&b, expected);

0 commit comments

Comments
 (0)