Skip to content

Commit d12f10f

Browse files
zhassan-awstautschnigcarolynzech
authored
Enable Kani to work with a stable toolchain (#3964)
As discussed in #3960, applying changes needed for the stable branch in main to minimize the differences between the two branches. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Michael Tautschnig <mt@debian.org> Co-authored-by: Carolyn Zech <cmzech@amazon.com>
1 parent c8b15c6 commit d12f10f

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ KANI_SYSROOT ={value = "target/kani", relative = true}
2020
KANI_BUILD_LIBS ={value = "target/build-libs", relative = true}
2121
# Build Kani library without `build-std`.
2222
KANI_LEGACY_LIBS ={value = "target/legacy-libs", relative = true}
23+
# This is only required for stable but is a no-op for nightly channels
24+
RUSTC_BOOTSTRAP = "1"
2325

2426
[target.'cfg(all())']
2527
rustflags = [ # Global lints/warnings. Need to use underscore instead of -.

kani-compiler/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#![feature(f128)]
1717
#![feature(f16)]
1818
#![feature(non_exhaustive_omitted_patterns_lint)]
19+
#![feature(cfg_version)]
20+
// Once the `stable` branch is at 1.86 or later, remove this line, since float_next_up_down is stabilized
21+
#![cfg_attr(not(version("1.86")), feature(float_next_up_down))]
1922
#![feature(try_blocks)]
2023
extern crate rustc_abi;
2124
extern crate rustc_ast;

kani-driver/src/call_cargo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ crate-type = ["lib"]
206206
// Use CARGO_ENCODED_RUSTFLAGS instead of RUSTFLAGS is preferred. See
207207
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
208208
.env("CARGO_ENCODED_RUSTFLAGS", rustc_args.join(OsStr::new("\x1f")))
209+
// This is only required for stable but is a no-op for nightly channels
210+
.env("RUSTC_BOOTSTRAP", "1")
209211
.env("CARGO_TERM_PROGRESS_WHEN", "never");
210212

211213
match self.run_build_target(cmd, verification_target.target()) {

kani-driver/src/call_single_file.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ impl KaniSession {
8484
let mut cmd = Command::new(&self.kani_compiler);
8585
let kani_compiler_args = to_rustc_arg(kani_args);
8686
cmd.arg(kani_compiler_args).args(rustc_args);
87+
// This is only required for stable but is a no-op for nightly channels
88+
cmd.env("RUSTC_BOOTSTRAP", "1");
8789

8890
if self.args.common_args.quiet {
8991
self.run_suppress(cmd)?;

tests/cargo-ui/verbose-cmds/expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CARGO_ENCODED_RUSTFLAGS=
2-
cargo +nightly
2+
cargo +
33
Running: `goto-cc
44
Running: `goto-instrument
55
Checking harness dummy_harness...

0 commit comments

Comments
 (0)