Use local_rebuild property to support new check-cfg in case of rebuild
This commit is contained in:
parent
276a34666b
commit
ccbd304335
@ -1401,8 +1401,8 @@ impl<'a> Builder<'a> {
|
|||||||
rustflags.arg("-Zunstable-options");
|
rustflags.arg("-Zunstable-options");
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg(bootstrap)] should remove every code path where it's false
|
// #[cfg(bootstrap)]
|
||||||
const USE_NEW_CHECK_CFG_SYNTAX: bool = false;
|
let use_new_check_cfg_syntax = self.local_rebuild;
|
||||||
|
|
||||||
// Enable compile-time checking of `cfg` names, values and Cargo `features`.
|
// Enable compile-time checking of `cfg` names, values and Cargo `features`.
|
||||||
//
|
//
|
||||||
@ -1411,7 +1411,7 @@ impl<'a> Builder<'a> {
|
|||||||
// features but cargo isn't involved in the #[path] process and so cannot pass the
|
// features but cargo isn't involved in the #[path] process and so cannot pass the
|
||||||
// complete list of features, so for that reason we don't enable checking of
|
// complete list of features, so for that reason we don't enable checking of
|
||||||
// features for std crates.
|
// features for std crates.
|
||||||
if USE_NEW_CHECK_CFG_SYNTAX {
|
if use_new_check_cfg_syntax {
|
||||||
cargo.arg("-Zcheck-cfg");
|
cargo.arg("-Zcheck-cfg");
|
||||||
if mode == Mode::Std {
|
if mode == Mode::Std {
|
||||||
rustflags.arg("--check-cfg=cfg(feature,values(any()))");
|
rustflags.arg("--check-cfg=cfg(feature,values(any()))");
|
||||||
@ -1442,7 +1442,7 @@ impl<'a> Builder<'a> {
|
|||||||
.collect::<String>(),
|
.collect::<String>(),
|
||||||
None => String::new(),
|
None => String::new(),
|
||||||
};
|
};
|
||||||
if USE_NEW_CHECK_CFG_SYNTAX {
|
if use_new_check_cfg_syntax {
|
||||||
let values = values.strip_prefix(",").unwrap_or(&values); // remove the first `,`
|
let values = values.strip_prefix(",").unwrap_or(&values); // remove the first `,`
|
||||||
rustflags.arg(&format!("--check-cfg=cfg({name},values({values}))"));
|
rustflags.arg(&format!("--check-cfg=cfg({name},values({values}))"));
|
||||||
} else {
|
} else {
|
||||||
@ -1463,7 +1463,7 @@ impl<'a> Builder<'a> {
|
|||||||
// We also declare that the flag is expected, which we need to do to not
|
// We also declare that the flag is expected, which we need to do to not
|
||||||
// get warnings about it being unexpected.
|
// get warnings about it being unexpected.
|
||||||
hostflags.arg("-Zunstable-options");
|
hostflags.arg("-Zunstable-options");
|
||||||
if USE_NEW_CHECK_CFG_SYNTAX {
|
if use_new_check_cfg_syntax {
|
||||||
hostflags.arg("--check-cfg=cfg(bootstrap)");
|
hostflags.arg("--check-cfg=cfg(bootstrap)");
|
||||||
} else {
|
} else {
|
||||||
hostflags.arg("--check-cfg=values(bootstrap)");
|
hostflags.arg("--check-cfg=values(bootstrap)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user