Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a good question.

If dropping was really implemented that way, every type would need to implement the Drop trait. Because otherwise there would be no way to free any memory at all.

Instead, Rust knows how to free any object. Implementing Drop is optional, and you only need to do it if you want some custom behavior at destruction.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: