@@ -50,7 +50,7 @@ use middle::trans::cleanup;
5050use middle:: trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_integral , C_nil } ;
5151use middle:: trans:: common:: { C_null , C_struct_in_context , C_u64 , C_u8 , C_uint , C_undef } ;
5252use middle:: trans:: common:: { CrateContext , ExternMap , FunctionContext } ;
53- use middle:: trans:: common:: { NodeInfo , Result , SubstP , monomorphize_type } ;
53+ use middle:: trans:: common:: { NodeInfo , Result , SubstP } ;
5454use middle:: trans:: common:: { node_id_type, param_substs, return_type_is_void} ;
5555use middle:: trans:: common:: { tydesc_info, type_is_immediate} ;
5656use middle:: trans:: common:: { type_is_zero_size, val_ty} ;
@@ -1794,7 +1794,6 @@ pub fn trans_closure(ccx: &CrateContext,
17941794 param_substs : & param_substs ,
17951795 fn_ast_id : ast:: NodeId ,
17961796 _attributes : & [ ast:: Attribute ] ,
1797- arg_types : Vec < ty:: t > ,
17981797 output_type : ty:: FnOutput ,
17991798 abi : Abi ,
18001799 has_env : bool ,
@@ -1829,9 +1828,19 @@ pub fn trans_closure(ccx: &CrateContext,
18291828
18301829 // Set up arguments to the function.
18311830 let monomorphized_arg_types =
1832- arg_types. iter( )
1833- . map( |at| monomorphize_type( bcx, * at) )
1834- . collect :: < Vec < _ > > ( ) ;
1831+ decl. inputs. iter( )
1832+ . map( |arg| node_id_type( bcx, arg. id) )
1833+ . collect :: < Vec < _ > > ( ) ;
1834+ let monomorphized_arg_types = match is_unboxed_closure {
1835+ NotUnboxedClosure => monomorphized_arg_types,
1836+
1837+ // Tuple up closure argument types for the "rust-call" ABI.
1838+ IsUnboxedClosure => vec![ if monomorphized_arg_types. is_empty( ) {
1839+ ty:: mk_nil( )
1840+ } else {
1841+ ty:: mk_tup( ccx. tcx( ) , monomorphized_arg_types)
1842+ } ]
1843+ } ;
18351844 for monomorphized_arg_type in monomorphized_arg_types. iter( ) {
18361845 debug ! ( "trans_closure: monomorphized_arg_type: {}" ,
18371846 ty_to_string( ccx. tcx( ) , * monomorphized_arg_type) ) ;
@@ -1933,7 +1942,6 @@ pub fn trans_fn(ccx: &CrateContext,
19331942 debug ! ( "trans_fn(param_substs={})" , param_substs. repr( ccx. tcx( ) ) ) ;
19341943 let _icx = push_ctxt ( "trans_fn" ) ;
19351944 let fn_ty = ty:: node_id_to_type ( ccx. tcx ( ) , id) ;
1936- let arg_types = ty:: ty_fn_args ( fn_ty) ;
19371945 let output_type = ty:: ty_fn_ret ( fn_ty) ;
19381946 let abi = ty:: ty_fn_abi ( fn_ty) ;
19391947 trans_closure ( ccx,
@@ -1943,7 +1951,6 @@ pub fn trans_fn(ccx: &CrateContext,
19431951 param_substs,
19441952 id,
19451953 attrs,
1946- arg_types,
19471954 output_type,
19481955 abi,
19491956 false ,
0 commit comments