@@ -1575,55 +1575,6 @@ fn copy_args_to_allocas<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1575
1575
bcx
1576
1576
}
1577
1577
1578
- fn copy_closure_args_to_allocas < ' blk , ' tcx > ( mut bcx : Block < ' blk , ' tcx > ,
1579
- arg_scope : cleanup:: CustomScopeIndex ,
1580
- args : & [ ast:: Arg ] ,
1581
- arg_datums : Vec < RvalueDatum < ' tcx > > ,
1582
- monomorphized_arg_types : & [ Ty < ' tcx > ] )
1583
- -> Block < ' blk , ' tcx > {
1584
- let _icx = push_ctxt ( "copy_closure_args_to_allocas" ) ;
1585
- let arg_scope_id = cleanup:: CustomScope ( arg_scope) ;
1586
-
1587
- assert_eq ! ( arg_datums. len( ) , 1 ) ;
1588
-
1589
- let arg_datum = arg_datums. into_iter ( ) . next ( ) . unwrap ( ) ;
1590
-
1591
- // Untuple the rest of the arguments.
1592
- let tuple_datum =
1593
- unpack_datum ! ( bcx,
1594
- arg_datum. to_lvalue_datum_in_scope( bcx,
1595
- "argtuple" ,
1596
- arg_scope_id) ) ;
1597
- let untupled_arg_types = match monomorphized_arg_types[ 0 ] . sty {
1598
- ty:: ty_tup( ref types) => & types[ ..] ,
1599
- _ => {
1600
- bcx. tcx ( ) . sess . span_bug ( args[ 0 ] . pat . span ,
1601
- "first arg to `rust-call` ABI function \
1602
- wasn't a tuple?!")
1603
- }
1604
- } ;
1605
- for j in 0 ..args. len ( ) {
1606
- let tuple_element_type = untupled_arg_types[ j] ;
1607
- let tuple_element_datum =
1608
- tuple_datum. get_element ( bcx,
1609
- tuple_element_type,
1610
- |llval| GEPi ( bcx, llval, & [ 0 , j] ) ) ;
1611
- let tuple_element_datum = tuple_element_datum. to_expr_datum ( ) ;
1612
- let tuple_element_datum =
1613
- unpack_datum ! ( bcx,
1614
- tuple_element_datum. to_rvalue_datum( bcx,
1615
- "arg" ) ) ;
1616
- bcx = _match:: store_arg ( bcx,
1617
- & * args[ j] . pat ,
1618
- tuple_element_datum,
1619
- arg_scope_id) ;
1620
-
1621
- debuginfo:: create_argument_metadata ( bcx, & args[ j] ) ;
1622
- }
1623
-
1624
- bcx
1625
- }
1626
-
1627
1578
// Ties up the llstaticallocas -> llloadenv -> lltop edges,
1628
1579
// and builds the return block.
1629
1580
pub fn finish_fn < ' blk , ' tcx > ( fcx : & ' blk FunctionContext < ' blk , ' tcx > ,
@@ -1781,33 +1732,18 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1781
1732
debug ! ( "trans_closure: function lltype: {}" ,
1782
1733
bcx. fcx. ccx. tn( ) . val_to_string( bcx. fcx. llfn) ) ;
1783
1734
1784
- let arg_datums = if abi != RustCall {
1785
- create_datums_for_fn_args ( & fcx,
1786
- & monomorphized_arg_types[ ..] )
1787
- } else {
1788
- create_datums_for_fn_args_under_call_abi (
1789
- bcx,
1790
- arg_scope,
1791
- & monomorphized_arg_types[ ..] )
1792
- } ;
1793
-
1794
- bcx = match closure_env {
1795
- closure:: ClosureEnv :: NotClosure => {
1796
- copy_args_to_allocas ( bcx,
1797
- arg_scope,
1798
- & decl. inputs ,
1799
- arg_datums)
1735
+ let arg_datums = match closure_env {
1736
+ closure:: ClosureEnv :: NotClosure if abi == RustCall => {
1737
+ create_datums_for_fn_args_under_call_abi ( bcx, arg_scope, & monomorphized_arg_types[ ..] )
1800
1738
}
1801
- closure:: ClosureEnv :: Closure ( _) => {
1802
- copy_closure_args_to_allocas (
1803
- bcx,
1804
- arg_scope,
1805
- & decl. inputs ,
1806
- arg_datums,
1807
- & monomorphized_arg_types[ ..] )
1739
+ _ => {
1740
+ let arg_tys = untuple_arguments_if_necessary ( ccx, & monomorphized_arg_types, abi) ;
1741
+ create_datums_for_fn_args ( & fcx, & arg_tys)
1808
1742
}
1809
1743
} ;
1810
1744
1745
+ bcx = copy_args_to_allocas ( bcx, arg_scope, & decl. inputs , arg_datums) ;
1746
+
1811
1747
bcx = closure_env. load ( bcx, cleanup:: CustomScope ( arg_scope) ) ;
1812
1748
1813
1749
// Up until here, IR instructions for this function have explicitly not been annotated with
0 commit comments