I really have a problem to understand rust of only one reference.
I really have a problem to understand rust of only one reference.
@rust_discussions Somehow I've never seen or thought about the Vec reallocating from under you example.
The application that comes to mind for me is when a function takes both a &mut T and a &T. The &mut T is exclusive, so the compiler can safely do optimizations that assume both parameters reference different values so you can change the &mut T's value without affecting the &T.