A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Why / how does unsafe not affect niche optimisations?
The optimizations still take place, they just result in wrong code if you set it to 0. The usafe constructor variant just puts the responsibility of that on you. It's assumed you have prior checks and reasoning or trusted input only, to ensure it doesn't happen.