Skip to content

Concrete playback needs tweak with overridden rust-toolchain #1581

Closed

Description

@zhassan-aws

The instructions for the concrete playback feature mention that once a concrete playback test is generated, one can run it with cargo test. For packages that pin a specific rust toolchain (e.g. via a rust-toolchain file), this could result in an error if the pinned rust toolchain is a stable release because compiling Kani requires using nightly due to the usage of unstable features.

Steps to reproduce:

  1. cargo new --lib conc_playback
  2. cd conc_playback
  3. Add kani to the dev dependencies in Cargo.toml:
[dev-dependencies]
kani = { git = "https://github.com/model-checking/kani", features = ["concrete_playback"] }
  1. Create a file to pin the rust toolchain:
echo "1.63.0" > rust-toolchain
  1. Replace src/lib.rs with the following:
#[kani::proof]
fn main() {
    let x: u8 = kani::any();
    let y: u8 = kani::any();
    assert_eq!(x, y);
}
  1. Run Kani:
cargo kani --harness main --enable-unstable --concrete-playback=inplace
  1. Run cargo test kani_concrete_playback_main_241008145652399799 to run the concrete trace. This errors out with:
   Compiling conc_playback v0.1.0 (/home/ubuntu/examples/new-iss8/conc_playback)
   Compiling quote v1.0.21
   Compiling syn v1.0.99
   Compiling kani_macros v0.9.0 (https://github.com/model-checking/kani#6405617b)
   Compiling kani v0.9.0 (https://github.com/model-checking/kani#6405617b)
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /home/ubuntu/.cargo/git/checkouts/kani-0ce0dacf5e98886d/6405617/library/kani/src/lib.rs:5:1
  |
5 | #![feature(rustc_attrs)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `kani` due to previous error

Activity

  1. added
    [C] Bug
    on Aug 23, 2022
  2. zhassan-aws commented on Aug 23, 2022

    @zhassan-aws
    ContributorAuthor

    The workaround is to run cargo test with nightly, e.g.:

    cargo +nightly-2022-08-16 test kani_concrete_playback_main_241008145652399799
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] Bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions