Crates.io | kani-verifier |
lib.rs | kani-verifier |
version | |
source | src |
created_at | 2022-01-19 21:14:56.536377 |
updated_at | 2024-10-09 23:59:36.488355 |
description | A bit-precise model checker for Rust. |
homepage | https://github.com/model-checking/kani |
repository | https://github.com/model-checking/kani |
max_upload_size | |
id | 517085 |
Cargo.toml error: | TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
The Kani Rust Verifier is a bit-precise model checker for Rust.
Kani is particularly useful for verifying unsafe code blocks in Rust, where the "unsafe superpowers" are unchecked by the compiler.
Kani verifies:
assert!(...)
)unwrap()
on None
values)To install the latest version of Kani (Rust 1.58+; Linux or Mac), run:
cargo install --locked kani-verifier
cargo kani setup
See the installation guide for more details.
Similar to testing, you write a harness, but with Kani you can check all possible values using kani::any()
:
use my_crate::{function_under_test, meets_specification, precondition};
#[kani::proof]
fn check_my_property() {
// Create a nondeterministic input
let input = kani::any();
// Constrain it according to the function's precondition
kani::assume(precondition(input));
// Call the function under verification
let output = function_under_test(input);
// Check that it meets the specification
assert!(meets_specification(input, output));
}
Kani will then try to prove that all valid inputs produce acceptable outputs, without panicking or executing unexpected behavior. Otherwise Kani will generate a trace that points to the failure. We recommend following the tutorial to learn more about how to use Kani.
Use Kani in your CI with model-checking/kani-github-action@VERSION
. See the
GitHub Action section in the Kani
book
for details.
See SECURITY for more information.
If you are interested in contributing to Kani, please take a look at the developer documentation.
Kani is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
Kani contains code from the Rust project. Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See the Rust repository for details.