TLDR Tech / Practical
Rust's Box::leak and Box::from_raw pitfalls highlighted by Miri
A review of updates to Rust 1.99.0's documentation concerning Box::leak reveals, through Miri's analysis, that deallocating memory previously leaked by Box::leak frequently results in undefined behavior. Investigations into four typical scenarios under Stacked Borrows and Tree Borrows indicated that most methods contravene compiler expectations or aliasing regulations, although secure handling of memory using raw pointers or non-null references bypasses these problems.
Read the full story