diff options
| author | Jakob Degen <jakob.e.degen@gmail.com> | 2022-04-16 09:27:54 -0400 |
|---|---|---|
| committer | Jakob Degen <jakob.e.degen@gmail.com> | 2022-05-23 17:49:04 -0400 |
| commit | 09b0936db2bb3be67451c6f8948e90987e764f81 (patch) | |
| tree | 33c3a24a12791982173c389fabd5d317223beb9a /compiler/rustc_const_eval/src/const_eval | |
| parent | 222c5724ecc922fe67815f428c19f82c129d9386 (diff) | |
Refactor call terminator to always hold a destination place
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/machine.rs | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index d7cbc48e032..0c20324e452 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -60,7 +60,7 @@ fn eval_body_using_ecx<'mir, 'tcx>( ecx.push_stack_frame( cid.instance, body, - Some(&ret.into()), + &ret.into(), StackPopCleanup::Root { cleanup: false }, )?; diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 9e5b00462f3..9de5541bfe3 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -265,7 +265,8 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, instance: ty::Instance<'tcx>, _abi: Abi, args: &[OpTy<'tcx>], - _ret: Option<(&PlaceTy<'tcx>, mir::BasicBlock)>, + _dest: &PlaceTy<'tcx>, + _ret: Option<mir::BasicBlock>, _unwind: StackPopUnwind, // unwinding is not supported in consts ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>> { debug!("find_mir_or_eval_fn: {:?}", instance); @@ -293,6 +294,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, new_instance, _abi, args, + _dest, _ret, _unwind, )? @@ -307,17 +309,18 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, ecx: &mut InterpCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx>], - ret: Option<(&PlaceTy<'tcx>, mir::BasicBlock)>, + dest: &PlaceTy<'tcx, Self::PointerTag>, + target: Option<mir::BasicBlock>, _unwind: StackPopUnwind, ) -> InterpResult<'tcx> { // Shared intrinsics. - if ecx.emulate_intrinsic(instance, args, ret)? { + if ecx.emulate_intrinsic(instance, args, dest, target)? { return Ok(()); } let intrinsic_name = ecx.tcx.item_name(instance.def_id()); // CTFE-specific intrinsics. - let Some((dest, ret)) = ret else { + let Some(ret) = target else { return Err(ConstEvalErrKind::NeedsRfc(format!( "calling intrinsic `{}`", intrinsic_name |
