#[allow(dead_code)]
#[path = "version.rs"]
mod version;
use version::{rustc_version, Version};
use std::env;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=version.rs");
let version = match rustc_version() {
Some(version) => version,
None => {
println!(
"cargo:warning={}: unable to determine rustc version; assuming latest stable rustc (1.{})",
env!("CARGO_PKG_NAME"),
Version::LATEST.minor
);
Version::LATEST
}
};
if !version.probe(36, 2019, 4, 14) {
println!("cargo:rustc-cfg=portable_atomic_no_alloc");
}
if !version.probe(52, 2021, 3, 10) {
println!("cargo:rustc-cfg=portable_atomic_no_unsafe_op_in_unsafe_fn");
}
if version.nightly {
let sanitize = env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
if sanitize.contains("thread") {
println!("cargo:rustc-cfg=portable_atomic_sanitize_thread");
}
}
}