Remix.run Logo
Ygg2 21 hours ago

Mu. Invalid question. Rust doesn't disable compiler features. It gives you extra set of footguns when you ask for it.

As for the actual unloaded question, "What's the point of unsafe in Rust?" it is to contain and make it easier to identify sources of UB.

gcr 18 hours ago | parent [-]

The whole point of the rust rewrite is that bun is now thought to rely on rust’s memory safety features, but that assumption doesn’t hold if everything’s inside an unsafe block.

whytevuhuni 17 hours ago | parent [-]

Only ~4% of code is inside an unsafe block, so the idea is that for new code/contributions, the chance of introducing a new memory-safety bug is an order of magnitude lower.

Maybe in the future the unsafe code will go down to 1%, bringing that to two orders of magnitude.

Of course, only time will tell if that is true or not, but from experience I’d be willing to bet it is.