Merge pull request #1581 from Roguelazer/issue-1579
conservatively limit atomic features
This commit is contained in:
commit
3158bf9093
@ -14,6 +14,8 @@ fn main() {
|
|||||||
let target = env::var("TARGET").unwrap();
|
let target = env::var("TARGET").unwrap();
|
||||||
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
|
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
|
||||||
|
|
||||||
|
let has_atomic_integers = target_has_at_least_atomic_u64(&target);
|
||||||
|
|
||||||
// std::collections::Bound was stabilized in Rust 1.17
|
// std::collections::Bound was stabilized in Rust 1.17
|
||||||
// but it was moved to core::ops later in Rust 1.26:
|
// but it was moved to core::ops later in Rust 1.26:
|
||||||
// https://doc.rust-lang.org/core/ops/enum.Bound.html
|
// https://doc.rust-lang.org/core/ops/enum.Bound.html
|
||||||
@ -69,7 +71,7 @@ fn main() {
|
|||||||
println!("cargo:rustc-cfg=num_nonzero");
|
println!("cargo:rustc-cfg=num_nonzero");
|
||||||
}
|
}
|
||||||
|
|
||||||
if minor >= 34 {
|
if minor >= 34 && has_atomic_integers {
|
||||||
println!("cargo:rustc-cfg=std_integer_atomics");
|
println!("cargo:rustc-cfg=std_integer_atomics");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,3 +104,17 @@ fn rustc_minor_version() -> Option<u32> {
|
|||||||
|
|
||||||
u32::from_str(next).ok()
|
u32::from_str(next).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn target_has_at_least_atomic_u64(target: &str) -> bool {
|
||||||
|
// The cfg variable target_has_atomic is unstable
|
||||||
|
// so this data comes from the src/librustc_target/spec/*.rs
|
||||||
|
// files in the rust source. Generally, it's 64-bit platforms
|
||||||
|
// plus i686.
|
||||||
|
if target.starts_with("x86_64") || target.starts_with("i686") ||
|
||||||
|
target.starts_with("aarch64") || target.starts_with("powerpc64") ||
|
||||||
|
target.starts_with("sparc64") || target.starts_with("mips64el") {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user