@@ -6622,6 +6622,7 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
6622
6622
call_args += vec( lltaskptr) ;
6623
6623
for each ( uint i in _uint. range( 0 u, num_ty_param) ) {
6624
6624
auto llarg = llvm. LLVMGetParam ( fcx. llfn, arg_n) ;
6625
+ fcx. lltydescs += vec( llarg) ;
6625
6626
check ( llarg as int != 0 ) ;
6626
6627
call_args += vec( vp2i( bcx, llarg) ) ;
6627
6628
arg_n += 1 u;
@@ -6677,16 +6678,26 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
6677
6678
r = bcx. build . Call ( llnativefn, call_args) ;
6678
6679
rptr = fcx. llretptr ;
6679
6680
} else {
6681
+
6682
+ let vec[ tup( ValueRef , ty. t) ] drop_args = vec ( ) ;
6683
+
6680
6684
for ( ty. arg arg in args ) {
6681
6685
auto llarg = llvm. LLVMGetParam ( fcx. llfn , arg_n) ;
6682
6686
check ( llarg as int != 0 ) ;
6683
6687
push_arg ( bcx, call_args, llarg, arg. ty ) ;
6688
+ if ( arg. mode == ast. val ) {
6689
+ drop_args += vec ( tup ( llarg, arg. ty ) ) ;
6690
+ }
6684
6691
arg_n += 1 u;
6685
6692
}
6686
6693
6687
6694
r = trans_native_call ( bcx. build , ccx. glues , lltaskptr, ccx. externs ,
6688
6695
ccx. tn , ccx. llmod , name, pass_task, call_args) ;
6689
6696
rptr = bcx. build . BitCast ( fcx. llretptr , T_ptr ( T_i32 ( ) ) ) ;
6697
+
6698
+ for ( tup( ValueRef , ty. t) d in drop_args) {
6699
+ bcx = drop_ty ( bcx, d. _0 , d. _1 ) . bcx ;
6700
+ }
6690
6701
}
6691
6702
6692
6703
// We don't store the return value if it's nil, to avoid stomping on a nil
0 commit comments