@@ -26,8 +26,8 @@ use rustc_target::abi::{call::FnAbi, Align, HasDataLayout, Size, TargetDataLayou
2626use super :: {
2727 err_inval, throw_inval, throw_ub, throw_ub_custom, throw_unsup, GlobalId , Immediate ,
2828 InterpErrorInfo , InterpResult , MPlaceTy , Machine , MemPlace , MemPlaceMeta , Memory , MemoryKind ,
29- OpTy , Operand , Place , PlaceTy , Pointer , PointerArithmetic , Projectable , Provenance , Scalar ,
30- StackPopJump ,
29+ OpTy , Operand , Place , PlaceTy , Pointer , PointerArithmetic , Projectable , Provenance ,
30+ ReturnAction , Scalar ,
3131} ;
3232use crate :: errors;
3333use crate :: util;
@@ -161,9 +161,15 @@ pub enum StackPopCleanup {
161161
162162/// Return type of [`InterpCx::pop_stack_frame`].
163163pub struct StackPop < ' tcx , Prov : Provenance > {
164- pub jump : StackPopJump ,
165- pub target : StackPopCleanup ,
166- pub destination : MPlaceTy < ' tcx , Prov > ,
164+ /// Additional information about the action to be performed when returning from the popped
165+ /// stack frame.
166+ pub return_action : ReturnAction ,
167+
168+ /// [`return_to_block`](Frame::return_to_block) of the popped stack frame.
169+ pub return_to_block : StackPopCleanup ,
170+
171+ /// [`return_place`](Frame::return_place) of the popped stack frame.
172+ pub return_place : MPlaceTy < ' tcx , Prov > ,
167173}
168174
169175/// State of a local variable including a memoized layout
@@ -890,16 +896,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
890896 let frame =
891897 self . stack_mut ( ) . pop ( ) . expect ( "tried to pop a stack frame, but there were none" ) ;
892898
893- let target = frame. return_to_block ;
894- let destination = frame. return_place . clone ( ) ;
899+ let return_to_block = frame. return_to_block ;
900+ let return_place = frame. return_place . clone ( ) ;
895901
896- let jump = if cleanup {
902+ let return_action = if cleanup {
897903 M :: after_stack_pop ( self , frame, unwinding) ?
898904 } else {
899- StackPopJump :: NoCleanup
905+ ReturnAction :: NoCleanup
900906 } ;
901907
902- Ok ( StackPop { jump , target , destination } )
908+ Ok ( StackPop { return_action , return_to_block , return_place } )
903909 }
904910
905911 /// A private helper for [`pop_stack_frame`](InterpCx::pop_stack_frame).
@@ -1042,13 +1048,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10421048 // Report error from return value copy, if any.
10431049 copy_ret_result?;
10441050
1045- match frame. jump {
1046- StackPopJump :: Normal => { }
1047- StackPopJump :: NoJump => {
1051+ match frame. return_action {
1052+ ReturnAction :: Normal => { }
1053+ ReturnAction :: NoJump => {
10481054 // The hook already did everything.
10491055 return Ok ( ( ) ) ;
10501056 }
1051- StackPopJump :: NoCleanup => {
1057+ ReturnAction :: NoCleanup => {
10521058 // If we are not doing cleanup, also skip everything else.
10531059 assert ! ( self . stack( ) . is_empty( ) , "only the topmost frame should ever be leaked" ) ;
10541060 assert ! ( !unwinding, "tried to skip cleanup during unwinding" ) ;
@@ -1060,7 +1066,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10601066 // Normal return, figure out where to jump.
10611067 if unwinding {
10621068 // Follow the unwind edge.
1063- let unwind = match frame. target {
1069+ let unwind = match frame. return_to_block {
10641070 StackPopCleanup :: Goto { unwind, .. } => unwind,
10651071 StackPopCleanup :: Root { .. } => {
10661072 panic ! ( "encountered StackPopCleanup::Root when unwinding!" )
@@ -1070,7 +1076,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10701076 self . unwind_to_block ( unwind)
10711077 } else {
10721078 // Follow the normal return edge.
1073- match frame. target {
1079+ match frame. return_to_block {
10741080 StackPopCleanup :: Goto { ret, .. } => self . return_to_block ( ret) ,
10751081 StackPopCleanup :: Root { .. } => {
10761082 assert ! (
0 commit comments