@@ -1990,8 +1990,7 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f,
1990
1990
1991
1991
// Synthesize a closure type.
1992
1992
let @ty. t bindings_ty = ty. plain_ty( ty. ty_tup( bound_tys) ) ;
1993
- let TypeRef llbindings_ty = type_of( bcx. fcx. ccx,
1994
- bindings_ty) ;
1993
+ let TypeRef llbindings_ty = type_of( bcx. fcx. ccx, bindings_ty) ;
1995
1994
let TypeRef llclosure_ty =
1996
1995
T_ptr ( T_box ( T_struct ( vec( T_ptr ( T_tydesc ( ) ) ,
1997
1996
type_of( bcx. fcx. ccx,
@@ -2013,23 +2012,27 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f,
2013
2012
C_int ( abi. box_rc_field_body) ) ) ;
2014
2013
bcx. build. Store ( C_int ( 1 ) , rc) ;
2015
2014
2016
-
2017
2015
// Store bindings tydesc.
2018
2016
auto bound_tydesc =
2019
2017
bcx. build. GEP ( closure,
2020
2018
vec( C_int ( 0 ) ,
2021
2019
C_int ( abi. closure_elt_tydesc) ) ) ;
2022
-
2023
2020
auto bindings_tydesc = get_tydesc( bcx, bindings_ty) ;
2024
2021
bcx. build. Store ( bindings_tydesc, bound_tydesc) ;
2025
2022
2026
- // Copy args into body fields .
2027
- auto bindings =
2023
+ // Store thunk-target .
2024
+ auto bound_target =
2028
2025
bcx. build. GEP ( closure,
2029
2026
vec( C_int ( 0 ) ,
2030
- C_int ( abi. closure_elt_bindings) ) ) ;
2027
+ C_int ( abi. closure_elt_target) ) ) ;
2028
+ bcx. build. Store ( bcx. build. Load ( f_res. res. val) , bound_target) ;
2031
2029
2030
+ // Copy expr values into boxed bindings.
2032
2031
let int i = 0 ;
2032
+ auto bindings =
2033
+ bcx. build. GEP ( closure,
2034
+ vec( C_int ( 0 ) ,
2035
+ C_int ( abi. closure_elt_bindings) ) ) ;
2033
2036
for ( ValueRef v in bound_vals) {
2034
2037
auto bound = bcx. build. GEP ( bindings,
2035
2038
vec( C_int ( 0 ) , C_int ( i) ) ) ;
0 commit comments