Kani Rust Verifier
Open-source bit-precise model checker that verifies safety and correctness properties of Rust programs.
At a Glance
About Kani Rust Verifier
Kani is an open-source model checker for Rust, developed under the model-checking organization on GitHub. It analyzes Rust programs for undefined behavior, panics, arithmetic overflows, and user-defined correctness properties, and the project documentation says it is under active development with monthly releases.
What It Is
Kani is a verification tool that uses model checking to analyze Rust code. Instead of running specific test inputs, developers write proof harnesses, which resemble test or property-based test harnesses, and use kani::any() to create nondeterministic inputs that cover all possible values. Kani then either proves the property, disproves it with a counterexample, or may run out of resources.
What It Checks
For safety, Kani automatically checks for many kinds of undefined behavior, which makes it useful for verifying unsafe code blocks that the compiler does not check. For correctness, it checks panics such as unwrap() on None, arithmetic overflows, and custom properties expressed as assertions or function contracts.
Workflow and Setup
Kani is installed with cargo install --locked kani-verifier followed by cargo kani setup, and runs on Linux or Mac with Rust. A GitHub Action lets teams run it in CI. The documentation includes a tutorial covering loop unwinding and nondeterministic variables, plus reference pages for attributes, the Arbitrary trait, and bounded nondeterministic variables.
Experimental Features and Limitations
Experimental features documented include automatic harness generation, coverage, stubbing, contracts, loop contracts, concrete playback, and quantifiers. The documentation notes that not all Rust language features are supported, with concurrency given as an example, and publishes dedicated pages on soundness and feature support. Kani synchronizes with a recent Rust nightly in each release.
Collections
Popular collections
- Local-First Databases
Collection by @joemseifi
- Team of Agents
Collection by @joemseifi
- Pick Up Where Your Agent Left Off
Collection by @caiovalverde
- Read Your Agent's Code Before You Merge
Collection by @presscheck
Add Kani Rust Verifier to one of your collections.
Community Discussions
Be the first to start a conversation about Kani Rust Verifier
Share your experience with Kani Rust Verifier, ask questions, or help others learn from your insights.
Pricing
Open Source
Kani core verifier distributed under MIT and Apache-2.0 licenses; free to install and use.
- Bit-precise model checker for Rust
- Checks undefined behavior, panics, arithmetic overflow and custom assertions
- Function contracts
- GitHub Action for CI
- Licensed under MIT and Apache License 2.0
Capabilities
Key Features
- Bit-precise model checking of Rust programs
- Automatic detection of undefined behavior in unsafe code
- Checks for panics and arithmetic overflows
- Custom properties via assertions and function contracts
- Proof harnesses with nondeterministic inputs via kani::any()
- Counterexamples for disproved properties
- Experimental autoharness, coverage, stubbing, loop contracts, concrete playback, and quantifiers
- GitHub Action for CI
