doc fixups from review
This commit is contained in:
parent
6d4995f4e6
commit
cda6f0c25d
@ -819,7 +819,7 @@ pub fn push_stack_frame(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new stack frame, initializes it and pushes it unto the stack.
|
/// Creates a new stack frame, initializes it and pushes it onto the stack.
|
||||||
/// A private helper for [`push_stack_frame`](InterpCx::push_stack_frame).
|
/// A private helper for [`push_stack_frame`](InterpCx::push_stack_frame).
|
||||||
fn push_new_stack_frame(
|
fn push_new_stack_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -902,8 +902,8 @@ pub fn pop_stack_frame(
|
|||||||
Ok(StackPop { jump, target, destination })
|
Ok(StackPop { jump, target, destination })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A private helper for [`push_stack_frame`](InterpCx::push_stack_frame).
|
/// A private helper for [`pop_stack_frame`](InterpCx::pop_stack_frame).
|
||||||
/// Returns whatever the cleanup was done.
|
/// Returns `true` if cleanup has been done, `false` otherwise.
|
||||||
fn cleanup_current_frame_locals(&mut self) -> InterpResult<'tcx, bool> {
|
fn cleanup_current_frame_locals(&mut self) -> InterpResult<'tcx, bool> {
|
||||||
// Cleanup: deallocate locals.
|
// Cleanup: deallocate locals.
|
||||||
// Usually we want to clean up (deallocate locals), but in a few rare cases we don't.
|
// Usually we want to clean up (deallocate locals), but in a few rare cases we don't.
|
||||||
|
@ -977,11 +977,9 @@ pub(crate) fn eval_fn_tail_call(
|
|||||||
// which pushes a new stack frame, with the return address from
|
// which pushes a new stack frame, with the return address from
|
||||||
// the popped stack frame.
|
// the popped stack frame.
|
||||||
//
|
//
|
||||||
// Note that we can't use `pop_stack_frame` as it "executes"
|
// Note that we are using `pop_stack_frame` and not `return_from_current_stack_frame`,
|
||||||
// the goto to the return block, but we don't want to,
|
// as the latter "executes" the goto to the return block, but we don't want to,
|
||||||
// only the tail called function should return to the current
|
// only the tail called function should return to the current return block.
|
||||||
// return block.
|
|
||||||
|
|
||||||
M::before_stack_pop(self, self.frame())?;
|
M::before_stack_pop(self, self.frame())?;
|
||||||
|
|
||||||
let StackPop { jump, target, destination } = self.pop_stack_frame(false)?;
|
let StackPop { jump, target, destination } = self.pop_stack_frame(false)?;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(explicit_tail_calls)]
|
#![feature(explicit_tail_calls)]
|
||||||
|
|
||||||
/// A very unnecessarily complicated "implementation" of the callatz conjecture.
|
/// A very unnecessarily complicated "implementation" of the Collatz conjecture.
|
||||||
/// Returns the number of steps to reach `1`.
|
/// Returns the number of steps to reach `1`.
|
||||||
///
|
///
|
||||||
/// This is just a test for tail calls, which involves multiple functions calling each other.
|
/// This is just a test for tail calls, which involves multiple functions calling each other.
|
||||||
|
Loading…
Reference in New Issue
Block a user