Skip to content

Commit

Permalink
Merge branch 'main' into issue-3228-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval authored Jul 4, 2024
2 parents 3c4e851 + fcc9d8b commit b07ee9d
Show file tree
Hide file tree
Showing 95 changed files with 3,090 additions and 155 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ This file contains notable changes (e.g. breaking changes, major changes, etc.)

This file was introduced starting Kani 0.23.0, so it only contains changes from version 0.23.0 onwards.

## [0.53.0]

### Major Changes
* The `--visualize` option is being deprecated and will be removed in a future release. Consider using the `--concrete-playback` option instead.
* The `-Z ptr-to-ref-cast-checks` option is being introduced to check pointer validity when casting raw pointers to references. The feature is currently behind an unstable flag but is expected to be stabilized in a future release once remaining performance issues have been resolved.
* The `-Z uninit-checks` option is being introduced to check memory initialization. The feature is currently behind an unstable flag and also requires the `-Z ghost-state` option.

### Breaking Changes
* Remove support for the unstable argument `--function` by @celinval in https://github.com/model-checking/kani/pull/3278
* Remove deprecated `--enable-stubbing` by @celinval in https://github.com/model-checking/kani/pull/3309

### What's Changed

* Change ensures into closures by @pi314mm in https://github.com/model-checking/kani/pull/3207
* (Re)introduce `Invariant` trait by @adpaco-aws in https://github.com/model-checking/kani/pull/3190
* Remove empty box creation from contracts impl by @celinval in https://github.com/model-checking/kani/pull/3233
* Add a new verify-std subcommand to Kani by @celinval in https://github.com/model-checking/kani/pull/3231
* Inject pointer validity check when casting raw pointers to references by @artemagvanian in https://github.com/model-checking/kani/pull/3221
* Do not turn trivially diverging loops into assume(false) by @tautschnig in https://github.com/model-checking/kani/pull/3223
* Fix "unused mut" warnings created by generated code. by @jsalzbergedu in https://github.com/model-checking/kani/pull/3247
* Refactor stubbing so Kani compiler only invoke rustc once per crate by @celinval in https://github.com/model-checking/kani/pull/3245
* Use cfg=kani_host for host crates by @tautschnig in https://github.com/model-checking/kani/pull/3244
* Add intrinsics and Arbitrary support for no_core by @jaisnan in https://github.com/model-checking/kani/pull/3230
* Contracts: Avoid attribute duplication and `const` function generation for constant function by @celinval in https://github.com/model-checking/kani/pull/3255
* Fix contract of constant fn with effect feature by @celinval in https://github.com/model-checking/kani/pull/3259
* Fix typed_swap for ZSTs by @tautschnig in https://github.com/model-checking/kani/pull/3256
* Add a `#[derive(Invariant)]` macro by @adpaco-aws in https://github.com/model-checking/kani/pull/3250
* Contracts: History Expressions via "old" monad by @pi314mm in https://github.com/model-checking/kani/pull/3232
* Function Contracts: remove instances of _renamed by @pi314mm in https://github.com/model-checking/kani/pull/3274
* Deprecate `--visualize` in favor of concrete playback by @celinval in https://github.com/model-checking/kani/pull/3281
* Fix operand in fat pointer comparison by @pi314mm in https://github.com/model-checking/kani/pull/3297
* Function Contracts: Closure Type Inference by @pi314mm in https://github.com/model-checking/kani/pull/3307
* Add support for f16 and f128 for toolchain upgrade to 6/28 by @jaisnan in https://github.com/model-checking/kani/pull/3306
* Towards Proving Memory Initialization by @artemagvanian in https://github.com/model-checking/kani/pull/3264
* Rust toolchain upgraded to `nightly-2024-07-01` by @tautschnig @celinval @jaisnan @adpaco-aws

**Full Changelog**: https://github.com/model-checking/kani/compare/kani-0.52.0...kani-0.53.0

## [0.52.0]

## What's Changed
Expand Down
52 changes: 26 additions & 26 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"

[[package]]
name = "bitflags"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"

[[package]]
name = "build-kani"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"anyhow",
"cargo_metadata",
Expand Down Expand Up @@ -140,19 +140,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "clap"
version = "4.5.7"
version = "4.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d"
dependencies = [
"clap_builder",
"clap_derive",
]

[[package]]
name = "clap_builder"
version = "4.5.7"
version = "4.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708"
dependencies = [
"anstream",
"anstyle",
Expand All @@ -162,9 +162,9 @@ dependencies = [

[[package]]
name = "clap_derive"
version = "4.5.5"
version = "4.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085"
dependencies = [
"heck",
"proc-macro2",
Expand Down Expand Up @@ -228,7 +228,7 @@ dependencies = [

[[package]]
name = "cprover_bindings"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"lazy_static",
"linear-map",
Expand Down Expand Up @@ -290,9 +290,9 @@ dependencies = [

[[package]]
name = "either"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"

[[package]]
name = "encode_unicode"
Expand Down Expand Up @@ -405,14 +405,14 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"

[[package]]
name = "kani"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"kani_macros",
]

[[package]]
name = "kani-compiler"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"clap",
"cprover_bindings",
Expand All @@ -433,7 +433,7 @@ dependencies = [

[[package]]
name = "kani-driver"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"anyhow",
"cargo_metadata",
Expand Down Expand Up @@ -461,7 +461,7 @@ dependencies = [

[[package]]
name = "kani-verifier"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"anyhow",
"home",
Expand All @@ -470,14 +470,14 @@ dependencies = [

[[package]]
name = "kani_core"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"kani_macros",
]

[[package]]
name = "kani_macros"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"proc-macro-error",
"proc-macro2",
Expand All @@ -487,7 +487,7 @@ dependencies = [

[[package]]
name = "kani_metadata"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"clap",
"cprover_bindings",
Expand Down Expand Up @@ -536,9 +536,9 @@ dependencies = [

[[package]]
name = "log"
version = "0.4.21"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"

[[package]]
name = "matchers"
Expand Down Expand Up @@ -587,9 +587,9 @@ dependencies = [

[[package]]
name = "num-bigint"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7"
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
"num-integer",
"num-traits",
Expand Down Expand Up @@ -929,9 +929,9 @@ dependencies = [

[[package]]
name = "serde_json"
version = "1.0.117"
version = "1.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
checksum = "e8eddb61f0697cc3989c5d64b452f5488e2b8a60fd7d5076a3045076ffef8cb0"
dependencies = [
"itoa",
"ryu",
Expand Down Expand Up @@ -992,7 +992,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"

[[package]]
name = "std"
version = "0.52.0"
version = "0.53.0"
dependencies = [
"kani",
]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "kani-verifier"
version = "0.52.0"
version = "0.53.0"
edition = "2021"
description = "A bit-precise model checker for Rust."
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion cprover_bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "cprover_bindings"
version = "0.52.0"
version = "0.53.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false
Expand Down
26 changes: 26 additions & 0 deletions cprover_bindings/src/goto_program/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ pub enum ExprValue {
// {}
EmptyUnion,
/// `1.0f`
Float16Constant(f16),
/// `1.0f`
FloatConstant(f32),
/// `Float 128 example`
Float128Constant(f128),
/// `function(arguments)`
FunctionCall {
function: Expr,
Expand Down Expand Up @@ -581,6 +585,28 @@ impl Expr {
expr!(EmptyUnion, typ)
}

/// `3.14f`
pub fn float16_constant(c: f16) -> Self {
expr!(Float16Constant(c), Type::float16())
}

/// `union {_Float16 f; uint16_t bp} u = {.bp = 0x1234}; >>> u.f <<<`
pub fn float16_constant_from_bitpattern(bp: u16) -> Self {
let c = f16::from_bits(bp);
Self::float16_constant(c)
}

/// `3.14159265358979323846264338327950288L`
pub fn float128_constant(c: f128) -> Self {
expr!(Float128Constant(c), Type::float128())
}

/// `union {_Float128 f; __uint128_t bp} u = {.bp = 0x1234}; >>> u.f <<<`
pub fn float128_constant_from_bitpattern(bp: u128) -> Self {
let c = f128::from_bits(bp);
Self::float128_constant(c)
}

/// `1.0f`
pub fn float_constant(c: f32) -> Self {
expr!(FloatConstant(c), Type::float())
Expand Down
Loading

0 comments on commit b07ee9d

Please sign in to comment.