News for hackers. Stuff that matters.
Re:Why Discord is switching from Go to Rust (2020) by afdbcreid on Wednesday April 13, 2022 @11:41PM (#31023188)
> perhaps std::mem::forget should be marked unsafe

It was in the past IIRC. The problem is that there are multiple ways to leak resources in safe Rust (e.g. creating `Rc` cycles), and the compiler cannot prevent them all. So leaking is safe, and because it's also useful sometimes, `std::mem::forget()` and friends (e.g. `Box::leak()`) are also safe. That being said, it is pretty hard to accidentally leak memory.

There are no comments on this comment yet.