Skip to content

Commit

Permalink
Add better target error message (rust-lang#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedinski committed Apr 20, 2022
1 parent 4f40fb7 commit a484fa9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/kani-verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ fn fail_if_in_dev_environment() -> Result<()> {
Ok(())
}

/// Give users a better error message than "404" if we're on an unsupported platform.
fn fail_if_unsupported_target() -> Result<()> {
// This is basically going to be reduced to a compile-time constant
match TARGET {
"x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" => Ok(()),
_ => bail!("Kani does not support this platform (Rust target {})", TARGET),
}
}

/// Sets up Kani by unpacking/installing to `~/.kani/kani-VERSION`
fn setup(use_local_bundle: Option<OsString>) -> Result<()> {
let kani_dir = kani_dir();
Expand All @@ -115,6 +124,7 @@ fn setup(use_local_bundle: Option<OsString>) -> Result<()> {
} else {
let filename = download_filename();
println!("[2/6] Downloading Kani release bundle: {}", &filename);
fail_if_unsupported_target()?;
let bundle = base_dir.join(filename);
Command::new("curl")
.args(&["-sSLf", "-o"])
Expand Down

0 comments on commit a484fa9

Please sign in to comment.