@@ -59,11 +59,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
5959 ref cleanup,
6060 ..
6161 } => {
62- let ( dest, ret) = match * destination {
63- Some ( ( ref lv, target) ) => ( Some ( self . eval_place ( lv) ?) , Some ( target) ) ,
64- None => ( None , None ) ,
65- } ;
66-
6762 let func = self . eval_operand ( func, None ) ?;
6863 let ( fn_val, abi) = match func. layout . ty . kind {
6964 ty:: FnPtr ( sig) => {
@@ -81,12 +76,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
8176 }
8277 } ;
8378 let args = self . eval_operands ( args) ?;
79+ let ret = match destination {
80+ Some ( ( dest, ret) ) => Some ( ( self . eval_place ( dest) ?, * ret) ) ,
81+ None => None ,
82+ } ;
8483 self . eval_fn_call (
8584 fn_val,
8685 terminator. source_info . span ,
8786 abi,
8887 & args[ ..] ,
89- dest,
9088 ret,
9189 * cleanup
9290 ) ?;
@@ -238,16 +236,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
238236 span : Span ,
239237 caller_abi : Abi ,
240238 args : & [ OpTy < ' tcx , M :: PointerTag > ] ,
241- dest : Option < PlaceTy < ' tcx , M :: PointerTag > > ,
242- ret : Option < mir:: BasicBlock > ,
239+ ret : Option < ( PlaceTy < ' tcx , M :: PointerTag > , mir:: BasicBlock ) > ,
243240 unwind : Option < mir:: BasicBlock >
244241 ) -> InterpResult < ' tcx > {
245242 trace ! ( "eval_fn_call: {:#?}" , fn_val) ;
246243
247244 let instance = match fn_val {
248245 FnVal :: Instance ( instance) => instance,
249246 FnVal :: Other ( extra) => {
250- return M :: call_extra_fn ( self , extra, args, dest , ret ) ;
247+ return M :: call_extra_fn ( self , extra, args, ret , unwind ) ;
251248 }
252249 } ;
253250
@@ -278,7 +275,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
278275 match instance. def {
279276 ty:: InstanceDef :: Intrinsic ( ..) => {
280277 assert ! ( caller_abi == Abi :: RustIntrinsic || caller_abi == Abi :: PlatformIntrinsic ) ;
281- return M :: call_intrinsic ( self , span, instance, args, dest , ret, unwind) ;
278+ return M :: call_intrinsic ( self , span, instance, args, ret, unwind) ;
282279 }
283280 ty:: InstanceDef :: VtableShim ( ..) |
284281 ty:: InstanceDef :: ReifyShim ( ..) |
@@ -288,7 +285,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
288285 ty:: InstanceDef :: CloneShim ( ..) |
289286 ty:: InstanceDef :: Item ( _) => {
290287 // We need MIR for this fn
291- let body = match M :: find_fn ( self , instance, args, dest , ret, unwind) ? {
288+ let body = match M :: find_fn ( self , instance, args, ret, unwind) ? {
292289 Some ( body) => body,
293290 None => return Ok ( ( ) ) ,
294291 } ;
@@ -297,8 +294,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
297294 instance,
298295 span,
299296 body,
300- dest ,
301- StackPopCleanup :: Goto { ret, unwind }
297+ ret . map ( |p| p . 0 ) ,
298+ StackPopCleanup :: Goto { ret : ret . map ( |p| p . 1 ) , unwind }
302299 ) ?;
303300
304301 // We want to pop this frame again in case there was an error, to put
@@ -381,7 +378,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
381378 throw_unsup ! ( FunctionArgCountMismatch )
382379 }
383380 // Don't forget to check the return type!
384- if let Some ( caller_ret) = dest {
381+ if let Some ( ( caller_ret, _ ) ) = ret {
385382 let callee_ret = self . eval_place (
386383 & mir:: Place :: return_place ( )
387384 ) ?;
@@ -447,7 +444,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
447444 } ) ;
448445 trace ! ( "Patched self operand to {:#?}" , args[ 0 ] ) ;
449446 // recurse with concrete function
450- self . eval_fn_call ( drop_fn, span, caller_abi, & args, dest , ret, unwind)
447+ self . eval_fn_call ( drop_fn, span, caller_abi, & args, ret, unwind)
451448 }
452449 }
453450 }
@@ -487,8 +484,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
487484 span,
488485 Abi :: Rust ,
489486 & [ arg. into ( ) ] ,
490- Some ( dest. into ( ) ) ,
491- Some ( target) ,
487+ Some ( ( dest. into ( ) , target) ) ,
492488 unwind
493489 )
494490 }
0 commit comments