Unsafe is a bad practice?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • miri

    An interpreter for Rust's mid-level intermediate representation

  • There are lots of these rules, and you need to know all of them if you want to write unsafe code. Now that's not to say it's impossible (clearly it isn't), but I'd strongly suggest reading the nomicon before starting. You can also use Miri which is an interpreter for Rust code that can detect UB during tests (a bit like a sanitizer).

  • too-many-lists

    Learn Rust by writing Entirely Too Many linked lists

  • How does this task list look? It sounds like you'd find it very interesting to read Learning Rust with Entirely Too Many Linked Lists as it explores some of these recursive issues quite well and describes idiomatic ways of doing things in Rust.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • nomicon

    The Dark Arts of Advanced and Unsafe Rust Programming

  • Unsafe is an escape hatch. You should use it when you have no other option. Most of the time, it’s not needed. Raw pointers in Rust are even more dangerous than in C/C++ because Rust’s release mode is a large percentage of the optimization options in llvm. If you cause any UB, it will probably blow up spectacularly. Look at the nomicon. This is basically a giant list of invariants you need to deal with to work with pointers in Rust.

  • kani

    Kani Rust Verifier

  • Check out Kani for unsafe code verification as well.

  • rust

    Empowering everyone to build reliable and efficient software.

  • Atomic reference-counting is simple enough, it's been in stdlib since forever and was designed by the experts. Did you know it had a data race as late as 2018? Worse, there is a race which causes a dangling reference on Drop. This is still open, and may still cause use after free.

  • slotmap

    Slotmap data structure for Rust

  • It's actually quite easy.

  • winsafe

    Windows API and GUI in safe, idiomatic Rust.

  • You might be interested in winsafe. There are a few examples how it can be used without unsafe code.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • winsafe-examples

    Examples of native Windows applications written in Rust with WinSafe.

  • You might be interested in winsafe. There are a few examples how it can be used without unsafe code.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts