Manishearth / compiletest-rs

An extraction of the compiletest utility from the Rust compiler
Apache License 2.0
216 stars 59 forks source link

does not build if HOST is not set #268

Open matthiaskrgr opened 1 year ago

matthiaskrgr commented 1 year ago
error: environment variable `HOST` not defined at compile time
   --> /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiletest_rs-0.10.0/src/common.rs:402:19
    |
402 |             host: env!("HOST").to_string(),
    |                   ^^^^^^^^^^^^
    |
    = help: Cargo sets build script variables at run time. Use `std::env::var("HOST")` instead
    = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `compiletest_rs` (lib) due to previous error

this currently breaks tests of clippy and rustcs x.py check Workaround is to run HOST="" cargo test or HOST="" ./x.py check. I wonder why this is needed at all, what is compiletest expecting here? Can we use option_env and unwrap_or_default maybe?

thomcc commented 1 year ago

This also breaks use with sccache: https://github.com/mozilla/sccache/issues/1766