Description
Continuing discussion from rust-lang/rust#55005 (comment)
Currently references in function arguments are special in that they must remain valid even after their last use. @RalfJung gave an example of a powerful optimization that relies on this behaviour.
Quoting the SB page:
Deallocating memory
Memory deallocation first acts like a write access through the pointer used for deallocation. After that is done, we additionally check all protectors remaining in the stack: if any of them is still active, we have undefined behavior.
What would be the impact of changing this to:
Deallocating memory
Memory deallocation first acts like a write access through the pointer used for deallocation. After that is done, we clear the stack,
It seems like the specific optimisation @RalfJung mentioned should still be valid, but perhaps there are other optimizations that would be prevented?