You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nope, you're not missing anything - this is indeed an error in the diagrams!
let _ = recursive_count_down(square(x)); does evaluate square(x) first and pop the frame, before calling recursive_count_down.
I'll fix the diagrams and add a blurb on printing the stack trace as you've described (seems there's no built-in environment variable to get a backtrace on stack overflow automatically, although the aptly-named backtrace-on-stack-overflow crate can help debug this issue in larger programs.
In https://highassurance.rs/chp4/assure_stack_1.html#the-stack, the stack diagram show that the stack frame for the
square
function still exist under all therecursive_count_down
stack frames.https://github.com/tnballo/high-assurance-rust/blob/main/src/chp4/stack_example.svg
But in my understanding, the stack frame of
square
should pop before the stack frames ofrecursive_count_down
are added.Indeed if I print the backtrace with:
I get:
Did I miss something ?
The text was updated successfully, but these errors were encountered: