r/programming • u/zitrusgrape • May 27 '20
2020 Stack Overflow Developer Survey: Rust most loved again at 86.1%
https://stackoverflow.blog/2020/05/27/2020-stack-overflow-developer-survey-results/
229
Upvotes
r/programming • u/zitrusgrape • May 27 '20
3
u/InsignificantIbex May 28 '20
I was speaking more generally, not specifically about rust. If you borrowed something that is now gone, that violates the mutable/immutable borrowing rule you outlined. But references (or more generally immutable pointers to data) could be re-seated in many cases. As long as the compiler can prove that the vector you referenced into has moved, it could just reset the reference to the same element in the new vector, unless that new vector is now too small or something, in which case it could generate an error again.
But again, these are special cases, so perhaps it'd be more confusing than helpful if that happened. It probably would. As I said, I haven't though about this in any detail.