num-bigint-dig/build.rs
Nicholas Bishop a2dc57562d Don't panic if autocfg probe fails
Motivation: [autocfg panics when building with `-Zbuild-std`][1].

Instead of panicking when the `i128` feature is requested but
`probe_type("i128")` fails, just go ahead and enable the feature. If
`i128` truly isn't available then compilation will still fail, just
later on. This is unlikely to be an issue in practice since [`i128`
was stabilized in Rust 1.26.0][2].

Tested by building with:

    cargo +nightly build --target=x86_64-unknown-uefi \
        -Zbuild-std=core,alloc --no-default-features \
        --features=i128

[1]: https://github.com/cuviper/autocfg/issues/34
[2]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1260-2018-05-10
2021-06-02 11:49:09 -04:00

11 lines
211 B
Rust

extern crate autocfg;
use std::env;
fn main() {
let ac = autocfg::new();
if ac.probe_type("i128") || env::var_os("CARGO_FEATURE_I128").is_some() {
println!("cargo:rustc-cfg=has_i128");
}
}