logoalt Hacker News

kace91today at 12:34 PM3 repliesview on HN

I’m not picturing how it works.

In rust you don’t have a garbage collector and you don’t manually deallocate - if the compiler is not certain of who drops memory and when, what happens with those ambiguous drops ?

In other words, are the silenced errors guaranteed to be memory leaks/use after frees?


Replies

gliptictoday at 12:51 PM

The borrow checker doesn't decide when things are dropped. It only checks reference uses and doesn't generate any code. This will work exactly the same as long as your program doesn't violate any borrowing rules.

show 1 reply
erutoday at 12:45 PM

I don't think so, I don't think Rust's borrow checker is free of false negatives.

MangoToupetoday at 1:27 PM

Rust's concept of lifetime and scopes exists independently of the borrow checker