Re:Algebraic Effects, Ownership, and Borrowing
by Measter on Thursday February 22, 2024 @06:38AM
(#39465701)
That article gives an example of where mutable aliasing isn't always dangerous:
In that specific example it isn't a problem because the type being changed is just an integer. But if you tweak it slightly it creates a use-after-free:
In this case `first_elem` is a `&[i32]`, and when `my_tuple` is reassigned the allocation is freed while the reference still exists.
[ Parent
| on HN ]
There are no comments on this comment yet.