Skip to content

Commit c6e9169

Browse files
author
Yoshiki Takashima
authored
NOP concrete playback to type check during verification mode. (rust-lang#2476)
1 parent 4a8712b commit c6e9169

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

library/kani/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ pub mod vec;
2121
pub use arbitrary::Arbitrary;
2222
#[cfg(feature = "concrete_playback")]
2323
pub use concrete_playback::concrete_playback_run;
24+
#[cfg(not(feature = "concrete_playback"))]
25+
/// NOP `concrete_playback` for type checking during verification mode.
26+
pub fn concrete_playback_run<F: Fn()>(_: Vec<Vec<u8>>, _: F) {
27+
unreachable!("Concrete playback does not work during verification")
28+
}
29+
2430
pub use futures::block_on;
2531

2632
/// Creates an assumption that will be valid after this statement run. Note that the assumption
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
[package]
4+
name = "playback-test"
5+
version = "0.1.0"
6+
edition = "2018"
7+
8+
[dependencies]
9+
10+
[workspace]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
#[kani::proof]
4+
fn main() {
5+
assert!(1 == 1);
6+
}
7+
8+
#[test]
9+
/// Purpose of this is to check if Kani can comple this code in
10+
/// verification mode when `kani::concrete_playback_run` is in the
11+
/// code,
12+
fn _playback_type_checks() {
13+
kani::concrete_playback_run(vec![], test_sum);
14+
}

0 commit comments

Comments
 (0)