Rollup merge of #72001 - mibac138:cfg-version, r=petrochenkov

Adjust cfg(version) to lang team decision

See https://github.com/rust-lang/rust/issues/64796#issuecomment-625474439 for details

r? @petrochenkov who reviewed the original PR (#71314)
This commit is contained in:
Dylan DPC 2020-05-08 14:11:49 +02:00 committed by GitHub
commit 5cef212dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() {