2 ms·
Box is just a library type; the borrow checker is a compiler feature. Different things entirely. I think what you're trying to get at is that the borrow checke
by pcwalton 7y ago
Box is just a library type; the borrow checker is a compiler feature. Different things entirely.
I think what you're trying to get at is that the borrow checker is based on static lifetimes (that's not the same thing as a "stack-based analysis", by the way). That's true. But that's simply because most lifetimes in practice follow simple static patterns. This is the same observation that motivates RAII in C++. Because heap management tends to follow the same few patterns over and over, judicious use of Rust compiler features and standard libraries can eliminate a lot of problems.