‹ BackHN Continuity

Thread

Developing provably correct Rust code with Verus

164 points · 79 comments · Betelbuddy

  1. bcjdjsndon · · focus · HN ↗
    > With Verus, however, developers can mathematically prove the safety of their unsafe Rust code, re-establishing machine-checked safety guarantees

    Why then does rust even need the unsafe keyword?

    1. ijustlovemath · · focus · HN ↗
      I'd rather have all the unsafe code scoped and the safety invariants explained than the alternative. You still can't do a whole class of scary things in an unsafe block; common misconception
      1. bcjdjsndon · · focus · HN ↗
        Yeah but if this program can prove unsafe code is safe... Why can't rust compiler do it, and hence, why do we even need unsafe if the compiler can do it.
        1. ijustlovemath · · focus · HN ↗
          It generates additional code that's fed into an SMT solver. Poor compiler performance is a top issue developers have with Rust, which they're working to solve. I think adding this layer into every piece of code (which is probably impossible since inferring the invariants is essentially inferring your business logic) would eat away gains they've achieved.

          I also think the functional style, typestate, and borrow checker is enough for writing correct code across many business domains, so there's no need to add this to your toolchain. We are a med device company building a class III (really 3 class II) device, and Verus is making our verification story extremely compelling.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.