What happens on the stack when one value shadows another in Rust? [duplicate]
问题 This question already has answers here : Does Rust free up the memory of overwritten variables? (2 answers) In Rust, what's the difference between “shadowing” and “mutability”? (1 answer) Closed 8 months ago . I am reading Mastering Rust. There is an exercise at the end of the first chapter where sample code is provided, and the task is to fix it, iterating by using the generally quite helpful compiler error messages. I was expecting that the following was an error but it is not : for line in