3 ms·
> I'm bothered by the need for "unsafe" code in pure Rust that's not calling hardware or C code. Why is this bothersome? I'm curious, as to me the advantage i
by ethbro 12y ago
> I'm bothered by the need for "unsafe" code in pure Rust that's not calling hardware or C code.
Why is this bothersome?
I'm curious, as to me the advantage is not in full-program safety, but in having a distinction between portions of a program that are guaranteed safe and portions that aren't.
Or, to turn it another way, Rust isn't giving you guarantees about 100% of the code you're looking at: it's vouching for the >0% (hopefully!) but <100% that's marked safe.
It seems an elegant, realistic engineering solution to a hard trade-off between performance and safety.
- Argorak 12y agoThe great part is that Rust has a bot that will ask for thorough code review if something inside an unsafe { } -block has changed. Static analysis for pragmatic reasons is really common in Rust even now. (BTW, unsafe {} is still a whole lot safer than standard C)