Is Rust Used Safely by Software Developers?
Interesting paper. Here&#x27;s one of their key conclusions:<p>&gt; Our analysis shows that while publicly available Rust libraries rarely use the unsafe keyword (even very popular libraries), most of them are still not Safe Rust, because of unsafe use in dependencies.<p>I think this might be a misapprehension of safety in Rust by the authors: safety doesn&#x27;t mean that absence of the `unsafe` keyword in your dependency tree, it means <i>safety by construction</i> through safe wrappers of fundamentally unsafe code.<p>The Rust standard library is the perfect example of this: it exposes safe interfaces that are built on top of fundamentally unsafe OS primitives and system calls. That doesn&#x27;t make any code that uses them &quot;unsafe&quot;; it parametrizes the notion of safety on safe abstractions. That&#x27;s all Rust has ever promised, and it&#x27;s <i>still</i> significantly better than the status quo.<p>Other than that, the paper&#x27;s other observations are excellent: we <i>should</i> be more aware of the presence of `unsafe` in our dependency trees, and that information <i>should</i> be more readily surfaced by standard tooling. Tools like `cargo geiger`[1] and `siderophile`[2] (FD: my company&#x27;s tool) bring us a little closer to that.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-secure-code&#x2F;cargo-geiger" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rust-secure-code&#x2F;cargo-geiger</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;trailofbits&#x2F;siderophile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;trailofbits&#x2F;siderophile</a>