Adjust cfg(version) to lang team decision

This commit is contained in:
mibac138 2020-05-08 00:07:18 +02:00
parent 97f3eeec82
commit cd291b8e51
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,5 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=CFG_VERSION");
println!("cargo:rerun-if-env-changed=CFG_RELEASE");
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
}

View File

@ -652,9 +652,12 @@ pub fn eval_condition(
return false;
}
};
let version = Version::parse(env!("CFG_VERSION")).unwrap();
let channel = env!("CFG_RELEASE_CHANNEL");
let nightly = channel == "nightly" || channel == "dev";
let rustc_version = Version::parse(env!("CFG_RELEASE")).unwrap();
version >= min_version
// See https://github.com/rust-lang/rust/issues/64796#issuecomment-625474439 for details
if nightly { rustc_version > min_version } else { rustc_version >= min_version }
}
ast::MetaItemKind::List(ref mis) => {
for mi in mis.iter() {