@@ -5135,6 +5135,13 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
5135
5135
auto fcx = new_fn_ctxt( cx, sp, llthunk) ;
5136
5136
auto bcx = new_top_block_ctxt( fcx) ;
5137
5137
auto lltop = bcx. llbb;
5138
+
5139
+ // The 'llenv' that will arrive in the thunk we're creating is an
5140
+ // environment that will contain the values of its arguments and a pointer
5141
+ // to the original function. So, let's create one of those:
5142
+
5143
+ // The llenv pointer needs to be the correct size. That size is
5144
+ // 'closure_ty', which was determined by trans_bind.
5138
5145
auto llclosure_ptr_ty =
5139
5146
type_of( cx. ccx, sp, ty:: mk_imm_box( cx. ccx. tcx, closure_ty) ) ;
5140
5147
auto llclosure = bcx. build. PointerCast ( fcx. llenv, llclosure_ptr_ty) ;
@@ -5296,14 +5303,12 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
5296
5303
// Translate the bound expressions.
5297
5304
let vec[ ty:: t] bound_tys = [ ] ;
5298
5305
let vec[ ValueRef ] bound_vals = [ ] ;
5299
- auto i = 0 u;
5300
5306
for ( @ast:: expr e in bound) {
5301
5307
auto arg = trans_expr( bcx, e) ;
5302
5308
bcx = arg. bcx;
5303
5309
vec:: push[ ValueRef ] ( bound_vals, arg. val) ;
5304
5310
vec:: push[ ty:: t] ( bound_tys,
5305
5311
ty:: expr_ty( cx. fcx. lcx. ccx. tcx, e) ) ;
5306
- i += 1 u;
5307
5312
}
5308
5313
5309
5314
// Synthesize a closure type.
@@ -5384,9 +5389,9 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
5384
5389
auto src = bcx. build. Load ( f_res. res. val) ;
5385
5390
bound_target = bcx. build. PointerCast ( bound_target, llclosurety) ;
5386
5391
bcx. build. Store ( src, bound_target) ;
5387
- // Copy expr values into boxed bindings.
5388
5392
5389
- i = 0 u;
5393
+ // Copy expr values into boxed bindings.
5394
+ auto i = 0 u;
5390
5395
auto bindings =
5391
5396
bcx. build. GEP ( closure,
5392
5397
[ C_int ( 0 ) , C_int ( abi:: closure_elt_bindings) ] ) ;
0 commit comments