@@ -50,7 +50,7 @@ use middle::trans::cleanup;
50
50
use middle:: trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_integral , C_nil } ;
51
51
use middle:: trans:: common:: { C_null , C_struct_in_context , C_u64 , C_u8 , C_uint , C_undef } ;
52
52
use middle:: trans:: common:: { CrateContext , ExternMap , FunctionContext } ;
53
- use middle:: trans:: common:: { NodeInfo , Result , SubstP , monomorphize_type } ;
53
+ use middle:: trans:: common:: { NodeInfo , Result , SubstP } ;
54
54
use middle:: trans:: common:: { node_id_type, param_substs, return_type_is_void} ;
55
55
use middle:: trans:: common:: { tydesc_info, type_is_immediate} ;
56
56
use middle:: trans:: common:: { type_is_zero_size, val_ty} ;
@@ -1794,7 +1794,6 @@ pub fn trans_closure(ccx: &CrateContext,
1794
1794
param_substs : & param_substs ,
1795
1795
fn_ast_id : ast:: NodeId ,
1796
1796
_attributes : & [ ast:: Attribute ] ,
1797
- arg_types : Vec < ty:: t > ,
1798
1797
output_type : ty:: FnOutput ,
1799
1798
abi : Abi ,
1800
1799
has_env : bool ,
@@ -1829,9 +1828,19 @@ pub fn trans_closure(ccx: &CrateContext,
1829
1828
1830
1829
// Set up arguments to the function.
1831
1830
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
+ } ;
1835
1844
for monomorphized_arg_type in monomorphized_arg_types. iter( ) {
1836
1845
debug ! ( "trans_closure: monomorphized_arg_type: {}" ,
1837
1846
ty_to_string( ccx. tcx( ) , * monomorphized_arg_type) ) ;
@@ -1933,7 +1942,6 @@ pub fn trans_fn(ccx: &CrateContext,
1933
1942
debug ! ( "trans_fn(param_substs={})" , param_substs. repr( ccx. tcx( ) ) ) ;
1934
1943
let _icx = push_ctxt ( "trans_fn" ) ;
1935
1944
let fn_ty = ty:: node_id_to_type ( ccx. tcx ( ) , id) ;
1936
- let arg_types = ty:: ty_fn_args ( fn_ty) ;
1937
1945
let output_type = ty:: ty_fn_ret ( fn_ty) ;
1938
1946
let abi = ty:: ty_fn_abi ( fn_ty) ;
1939
1947
trans_closure ( ccx,
@@ -1943,7 +1951,6 @@ pub fn trans_fn(ccx: &CrateContext,
1943
1951
param_substs,
1944
1952
id,
1945
1953
attrs,
1946
- arg_types,
1947
1954
output_type,
1948
1955
abi,
1949
1956
false ,
0 commit comments