@@ -817,23 +817,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
817
817
818
818
// The arguments we'll be passing. Plus one to account for outptr, if used.
819
819
let arg_count = fn_abi. args . len ( ) + fn_abi. ret . is_indirect ( ) as usize ;
820
- let mut llargs = Vec :: with_capacity ( arg_count) ;
821
-
822
- // Prepare the return value destination
823
- let ret_dest = self . make_return_dest (
824
- bx,
825
- destination,
826
- & fn_abi. ret ,
827
- & mut llargs,
828
- intrinsic. is_some ( ) ,
829
- target. is_some ( ) ,
830
- ) ;
831
820
832
821
if intrinsic == Some ( sym:: caller_location) {
833
822
return if let Some ( target) = target {
834
823
let location =
835
824
self . get_caller_location ( bx, mir:: SourceInfo { span : fn_span, ..source_info } ) ;
836
825
826
+ let mut llargs = Vec :: with_capacity ( arg_count) ;
827
+ let ret_dest =
828
+ self . make_return_dest ( bx, destination, & fn_abi. ret , & mut llargs, true , true ) ;
829
+ assert_eq ! ( llargs, [ ] ) ;
837
830
if let ReturnDest :: IndirectOperand ( tmp, _) = ret_dest {
838
831
location. val . store ( bx, tmp) ;
839
832
}
@@ -847,6 +840,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
847
840
match intrinsic {
848
841
None | Some ( sym:: drop_in_place) => { }
849
842
Some ( intrinsic) => {
843
+ let mut llargs = Vec :: with_capacity ( 1 ) ;
844
+ let ret_dest = self . make_return_dest (
845
+ bx,
846
+ destination,
847
+ & fn_abi. ret ,
848
+ & mut llargs,
849
+ true ,
850
+ target. is_some ( ) ,
851
+ ) ;
850
852
let dest = match ret_dest {
851
853
_ if fn_abi. ret . is_indirect ( ) => llargs[ 0 ] ,
852
854
ReturnDest :: Nothing => bx. const_undef ( bx. type_ptr ( ) ) ,
@@ -902,6 +904,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
902
904
}
903
905
}
904
906
907
+ let mut llargs = Vec :: with_capacity ( arg_count) ;
908
+ let destination = target. as_ref ( ) . map ( |& target| {
909
+ ( self . make_return_dest ( bx, destination, & fn_abi. ret , & mut llargs, false , true ) , target)
910
+ } ) ;
911
+
905
912
// Split the rust-call tupled arguments off.
906
913
let ( first_args, untuple) = if abi == Abi :: RustCall && !args. is_empty ( ) {
907
914
let ( tup, args) = args. split_last ( ) . unwrap ( ) ;
@@ -1042,14 +1049,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1042
1049
( _, Some ( llfn) ) => llfn,
1043
1050
_ => span_bug ! ( span, "no instance or llfn for call" ) ,
1044
1051
} ;
1045
-
1046
1052
helper. do_call (
1047
1053
self ,
1048
1054
bx,
1049
1055
fn_abi,
1050
1056
fn_ptr,
1051
1057
& llargs,
1052
- target . as_ref ( ) . map ( | & target| ( ret_dest , target ) ) ,
1058
+ destination ,
1053
1059
unwind,
1054
1060
& copied_constant_arguments,
1055
1061
mergeable_succ,
0 commit comments