The Benefits of Using Rust Even with Extensive `unsafe` Code
The article discusses the misconception that using Rust for systems-level code is not beneficial if one has to use a lot of unsafe
code. The author argues that even in software that heavily relies on Rust's unsafe
keyword and features, there are still significant benefits to be gained. The ability to distinguish between safe and unsafe code provides non-trivial advantages, especially when it comes to understanding and debugging the system. While Rust does come with a cognitive load, it is the first successful memory-safe systems language at an industrial scale. The article emphasizes that having some level of safety is better than having none, and even a codebase with 70% wrapped in unsafe
still leaves 30% where developers do not have to worry about memory safety. The tradeoff between safety and cognitive overhead is subjective, but the author believes that the benefits outweigh the costs. Overall, the article highlights the importance of considering the advantages of Rust even in scenarios where unsafe
code is prevalent.