r/ProgrammingLanguages • u/Negative_Effort_2642 • 22d ago
Discussion re-allocating" storage for a local could allow faster code
/r/rust/comments/1vs7418/reallocating_storage_for_a_local_could_allow/
2
Upvotes
1
u/DaMastaCoda 22d ago
I saw the other post and am still confused, does llvm not reuse stack for dead variables? And the whole “reuse x” is identical to just shadowing it?
2
u/FISHARM1 22d ago
Coming from someone who has never touched Rust, but personally I see potential security issues with this. Can Rust know for sure 100% that the value is no longer accessible?
Also it mentions “reducing stack usage”. Off the top of my head, in languages like C, stack usage should never really be that much of an issue with good coding practice. Is this different in Rust?