News for hackers. Stuff that matters.
Re:11 year old unsoundness bugs found in Rust borrow checker by j4k0bfr on Wednesday October 14, 2026 @01:32AM (#50082800)
I'm happy to admit I don't really know what I'm talking about with this bug, however the ability to leak memory is pretty demonstrable, no? The OP's example of using a global cache with Drop seems a bit gross... but that hasn't ever stopped C devs lol (as a proud C dev myself).

I guess my take is that I'd rather assume this is exploitable in the wild until sufficient time has passed. Would be cool to see clippy pick up on this bug in older versions!

Re:11 year old unsoundness bugs found in Rust borrow checker by aw1621107 on Wednesday October 14, 2026 @02:42AM (#50083340)
> however the ability to leak memory is pretty demonstrable, no?

This bug wouldn't be nearly as interesting if it "just" resulted in a memory leak. Memory leaks aren't considered unsafe in Rust because they can't result in UB in the same way as e.g., OOB writes. In fact, there are APIs accessible in safe Rust which explicitly leak memory! [0]

This bug is effectively a use-after-free, which is definitely something that the Rust compiler should catch.

> Would be cool to see clippy pick up on this bug in older versions!

No need for that. A future version of the Rust compiler that incorporates a fix should reject the incorrect code, so all you'd need to do is compile older code with that new compiler.

[0]: https://doc.rust-lang.org/std/mem/fn.forget.html

Re:11 year old unsoundness bugs found in Rust borrow checker by rstuart4133 on Wednesday October 14, 2026 @02:29AM (#50083236)
> however the ability to leak memory is pretty demonstrable

It is, but safe Rust merely makes it hard to do by accident. Leaking is not "memory unsafe" because is does not currupt anything, so it's legal.