@@ -59,11 +59,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
59
59
ref cleanup,
60
60
..
61
61
} => {
62
- let ( dest, ret) = match * destination {
63
- Some ( ( ref lv, target) ) => ( Some ( self . eval_place ( lv) ?) , Some ( target) ) ,
64
- None => ( None , None ) ,
65
- } ;
66
-
67
62
let func = self . eval_operand ( func, None ) ?;
68
63
let ( fn_val, abi) = match func. layout . ty . kind {
69
64
ty:: FnPtr ( sig) => {
@@ -81,12 +76,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
81
76
}
82
77
} ;
83
78
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
+ } ;
84
83
self . eval_fn_call (
85
84
fn_val,
86
85
terminator. source_info . span ,
87
86
abi,
88
87
& args[ ..] ,
89
- dest,
90
88
ret,
91
89
* cleanup
92
90
) ?;
@@ -238,16 +236,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
238
236
span : Span ,
239
237
caller_abi : Abi ,
240
238
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 ) > ,
243
240
unwind : Option < mir:: BasicBlock >
244
241
) -> InterpResult < ' tcx > {
245
242
trace ! ( "eval_fn_call: {:#?}" , fn_val) ;
246
243
247
244
let instance = match fn_val {
248
245
FnVal :: Instance ( instance) => instance,
249
246
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 ) ;
251
248
}
252
249
} ;
253
250
@@ -278,7 +275,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
278
275
match instance. def {
279
276
ty:: InstanceDef :: Intrinsic ( ..) => {
280
277
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) ;
282
279
}
283
280
ty:: InstanceDef :: VtableShim ( ..) |
284
281
ty:: InstanceDef :: ReifyShim ( ..) |
@@ -288,7 +285,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
288
285
ty:: InstanceDef :: CloneShim ( ..) |
289
286
ty:: InstanceDef :: Item ( _) => {
290
287
// 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) ? {
292
289
Some ( body) => body,
293
290
None => return Ok ( ( ) ) ,
294
291
} ;
@@ -297,8 +294,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
297
294
instance,
298
295
span,
299
296
body,
300
- dest ,
301
- StackPopCleanup :: Goto { ret, unwind }
297
+ ret . map ( |p| p . 0 ) ,
298
+ StackPopCleanup :: Goto { ret : ret . map ( |p| p . 1 ) , unwind }
302
299
) ?;
303
300
304
301
// 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> {
381
378
throw_unsup ! ( FunctionArgCountMismatch )
382
379
}
383
380
// Don't forget to check the return type!
384
- if let Some ( caller_ret) = dest {
381
+ if let Some ( ( caller_ret, _ ) ) = ret {
385
382
let callee_ret = self . eval_place (
386
383
& mir:: Place :: return_place ( )
387
384
) ?;
@@ -447,7 +444,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
447
444
} ) ;
448
445
trace ! ( "Patched self operand to {:#?}" , args[ 0 ] ) ;
449
446
// 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)
451
448
}
452
449
}
453
450
}
@@ -487,8 +484,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
487
484
span,
488
485
Abi :: Rust ,
489
486
& [ arg. into ( ) ] ,
490
- Some ( dest. into ( ) ) ,
491
- Some ( target) ,
487
+ Some ( ( dest. into ( ) , target) ) ,
492
488
unwind
493
489
)
494
490
}
0 commit comments