Skip to content

Commit a484fa9

Browse files
committed
Add better target error message (rust-lang#1069)
1 parent 4f40fb7 commit a484fa9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/kani-verifier/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ fn fail_if_in_dev_environment() -> Result<()> {
9090
Ok(())
9191
}
9292

93+
/// Give users a better error message than "404" if we're on an unsupported platform.
94+
fn fail_if_unsupported_target() -> Result<()> {
95+
// This is basically going to be reduced to a compile-time constant
96+
match TARGET {
97+
"x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" => Ok(()),
98+
_ => bail!("Kani does not support this platform (Rust target {})", TARGET),
99+
}
100+
}
101+
93102
/// Sets up Kani by unpacking/installing to `~/.kani/kani-VERSION`
94103
fn setup(use_local_bundle: Option<OsString>) -> Result<()> {
95104
let kani_dir = kani_dir();
@@ -115,6 +124,7 @@ fn setup(use_local_bundle: Option<OsString>) -> Result<()> {
115124
} else {
116125
let filename = download_filename();
117126
println!("[2/6] Downloading Kani release bundle: {}", &filename);
127+
fail_if_unsupported_target()?;
118128
let bundle = base_dir.join(filename);
119129
Command::new("curl")
120130
.args(&["-sSLf", "-o"])

0 commit comments

Comments
 (0)