Re:The Rust Libs Blitz
by the_why_of_y on Saturday May 06, 2017 @08:42AM
(#14279992)
The roughly equivalent annotation in D is called "@trusted", but IMHO "unsafe" is better because it sounds scarier :-)
https://dlang.org/blog/2016/09/28/how-to-write-trusted-code-...
> Everything else with unsafe code is an optimization. Often a premature one.
Rc, Arc and Box require unsafe code for the obvious reasons that are not premature optimisations. Any attempt to use a syscall (look at the nix crate which wraps libc with safe APIs) requires unsafe code.
Unsafe doesn't mean "this code is bad". It is true that unsafe code should be treated very carefully, but it's purpose is so that a sufficiently clever human can implement safe code that the insufficiently clever compiler cannot verify.
Really it should've been called trustme rather than unsafe. ;)