Skip to content

Commit b55e12b

Browse files
committed
add an assertion that machine hook doesn't return NoCleanup
1 parent 0e871a5 commit b55e12b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
899899
let return_to_block = frame.return_to_block;
900900
let return_place = frame.return_place.clone();
901901

902-
let return_action = if cleanup {
903-
M::after_stack_pop(self, frame, unwinding)?
902+
let return_action;
903+
if cleanup {
904+
return_action = M::after_stack_pop(self, frame, unwinding)?;
905+
assert_ne!(return_action, ReturnAction::NoCleanup);
904906
} else {
905-
ReturnAction::NoCleanup
907+
return_action = ReturnAction::NoCleanup;
906908
};
907909

908910
Ok(StackPopInfo { return_action, return_to_block, return_place })

0 commit comments

Comments
 (0)