3 ms·
> Its inspired from C++ unique_ptr and auto_ptr....the compiler writes the free() for you. The borrow checker does not determine when to call free. It also doe
by steveklabnik 4y ago
> Its inspired from C++ unique_ptr and auto_ptr....the compiler writes the free() for you.
The borrow checker does not determine when to call free. It also doesn't call malloc. It is completely orthogonal to heap allocation.
- vlovich123 4y agoI think people in this thread say borrow checker but mean RAII where the compiler injects Drop for you automatically. But that’s not so much the borrow checker and more lexical lifetimes. It‘s possible the borrow checker is involved with non lexical lifetimes? Not sure
- steveklabnik 4y agoThe borrow checker is what checks lifetimes, that's correct. "Non-lexical lifetimes" is an example of describing certain semantics of what the borrow checker checks, yes.