Skip to content

Commit

Permalink
NOP concrete playback to type check during verification mode. (#2476)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshikiTakashima authored May 26, 2023
1 parent 4a8712b commit c6e9169
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/kani/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ pub mod vec;
pub use arbitrary::Arbitrary;
#[cfg(feature = "concrete_playback")]
pub use concrete_playback::concrete_playback_run;
#[cfg(not(feature = "concrete_playback"))]
/// NOP `concrete_playback` for type checking during verification mode.
pub fn concrete_playback_run<F: Fn()>(_: Vec<Vec<u8>>, _: F) {
unreachable!("Concrete playback does not work during verification")
}

pub use futures::block_on;

/// Creates an assumption that will be valid after this statement run. Note that the assumption
Expand Down
10 changes: 10 additions & 0 deletions tests/cargo-kani/concrete-playback-in-verification-mode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT
[package]
name = "playback-test"
version = "0.1.0"
edition = "2018"

[dependencies]

[workspace]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[kani::proof]
fn main() {
assert!(1 == 1);
}

#[test]
/// Purpose of this is to check if Kani can comple this code in
/// verification mode when `kani::concrete_playback_run` is in the
/// code,
fn _playback_type_checks() {
kani::concrete_playback_run(vec![], test_sum);
}

0 comments on commit c6e9169

Please sign in to comment.