Hi everyone,
When the former value of a shadowed variable is removed from the memory?
Thanks and have a nice weekend!
Hi everyone,
When the former value of a shadowed variable is removed from the memory?
Thanks and have a nice weekend!
A variable's drop scope doesn't change when it gets shadowed, so, where ever it would have been removed without the shadowing (most frequently the end of the containing block).
If you wanted something else to happen, you could explicitly drop(the_variable) before shadowing.