Skip to content

Commit 7845f8f

Browse files
committed
kani: temporary patch to model-checking/kani#4312
1 parent cee0cca commit 7845f8f

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/gen_core.json.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o pipefail
44

55
export WORKSPACE="${WORKSPACE:-$(pwd)}"
66

7-
export RUST_LOG=off
7+
export DV_LOG=off
88
export OUTPUT_DIR=$WORKSPACE/assets
99
export KANI_DIR=$WORKSPACE/kani/target/kani
1010
export VERIFY_RUST_STD_LIBRARY=$WORKSPACE/verify-rust-std/library

.github/install-kani.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
set -ex
1+
#!/usr/bin/bash
2+
set -exo pipefail
23

34
# NOTE: verify-rust-std pins its kani commit, and
45
# distributed-verification pins another.
56
# So this means for verify-rust-std jobs,
67
# distributed-verification may be broken to compile.
78
git submodule update --init kani
89

10+
# Temporary patch to https://github.com/model-checking/kani/pull/4312
11+
cp .github/kani_contract_mode.patch kani
12+
913
# Install kani
1014
pushd kani
1115
git submodule update --init charon
@@ -14,7 +18,7 @@ git submodule update --init charon
1418
cargo build-dev -- --release
1519

1620
export PATH=$(pwd)/scripts:$PATH
17-
echo PATH=$PATH >>$GITHUB_ENV
21+
echo PATH="$PATH" >>"$GITHUB_ENV"
1822
kani --version
1923

2024
popd

.github/kani_contract_mode.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/library/kani_macros/src/sysroot/contracts/bootstrap.rs b/library/kani_macros/src/sysroot/contracts/bootstrap.rs
2+
index ed8bde7f8..d8f2eae87 100644
3+
--- a/library/kani_macros/src/sysroot/contracts/bootstrap.rs
4+
+++ b/library/kani_macros/src/sysroot/contracts/bootstrap.rs
5+
@@ -71,7 +71,7 @@ const fn kani_register_contract<T, F: FnOnce() -> T>(f: F) -> T {
6+
}
7+
// Dummy function that we replace to pick the contract mode.
8+
// By default, return ORIGINAL
9+
- #[inline(never)]
10+
+ #[inline]
11+
#[kanitool::fn_marker = "kani_contract_mode"]
12+
const fn kani_contract_mode() -> kani::internal::Mode {
13+
kani::internal::ORIGINAL

0 commit comments

Comments
 (0)