← All articles

Why the Borrow Checker Isn't Enough

The borrow checker proves memory safety, but not that your allocator, parser or controller is correct. Formal verification closes that gap.

Most developers treat Rust's borrow checker as the finish line. For critical systems, it's only the starting line.

Safe Rust guarantees memory safety and data-race freedom at compile time. What it cannot guarantee is functional correctness:

  • Does your custom allocator never hand out overlapping memory regions?
  • Does your binary parser satisfy round-trip consistency?
  • Does your distributed controller always converge to a desired state?

Which of these can the borrow checker verify?

Show the answers
  1. No use-after-free: The borrow checker can verify this. Safe Rust rejects a reference that outlives the value it points to, so a freed value cannot be reached through a reference.
  2. No data races: The borrow checker can verify this. Safe Rust rejects conflicting access to the same data from several places at once. Send and Sync decide what may cross threads.
  3. Memory safety: The borrow checker can verify this. Across safe code, the compiler's ownership and borrowing rules cover memory safety as a whole. The guarantee stops at unsafe blocks, which you must check yourself.
  4. Allocator regions don't overlap: The borrow checker cannot verify this. The checker reasons about the references in your code. Whether an allocator's internal bookkeeping hands out disjoint regions is a property of its logic, so it needs tests or a proof.
  5. Parser round-trips: The borrow checker cannot verify this. Parsing a value and serializing it back to the same bytes is a functional property. Types cannot express it, so it needs a test or a proof.
  6. Controller liveness: The borrow checker cannot verify this. Liveness is about what eventually happens over time in a distributed system. Borrow checking looks at one program's references, not at how a system behaves over time.

Formal verification closes that gap statically—checking executable Rust against mathematical specifications across all possible inputs, with zero runtime overhead.

If you want to push beyond "it compiles cleanly," tools like Verus and Kani are where the next decade of systems engineering is happening.

Where in your stack would mathematical proof of correctness actually pay for itself?