use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
let minor = Command::new(rustc)
.arg("--version")
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.and_then(|v| {
let mut it = v.split_whitespace().nth(1)?.split('.');
let major: u32 = it.next()?.parse().ok()?;
let minor: u32 = it.next()?.parse().ok()?;
Some(if major > 1 { u32::MAX } else { minor })
})
.unwrap_or(u32::MAX);
if minor >= 80 {
println!("cargo:rustc-check-cfg=cfg(announce_diagnostic)");
}
if minor >= 78 {
println!("cargo:rustc-cfg=announce_diagnostic");
}
}