Skip to content

Commit ff33001

Browse files
committed
Use new cargo argument of cfg checking in bootstrap
1 parent bef2b7c commit ff33001

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/bootstrap/builder.rs

+17-20
Original file line numberDiff line numberDiff line change
@@ -1355,29 +1355,26 @@ impl<'a> Builder<'a> {
13551355
// get some support for setting `--check-cfg` within build script, it's the least invasive
13561356
// hack that still let's us have cfg checking for the vast majority of the codebase.
13571357
if stage != 0 {
1358-
// Enable cfg checking of cargo features for everything but std.
1358+
// Enable cfg checking of cargo features for everything but std and also enable cfg
1359+
// checking of names and values.
13591360
//
13601361
// Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
1361-
// backtrace, core_simd, std_float, ...), those dependencies have their own features
1362-
// but cargo isn't involved in the #[path] and so cannot pass the complete list of
1363-
// features, so for that reason we don't enable checking of features for std.
1362+
// backtrace, core_simd, std_float, ...), those dependencies have their own
1363+
// features but cargo isn't involved in the #[path] process and so cannot pass the
1364+
// complete list of features, so for that reason we don't enable checking of
1365+
// features for std crates.
1366+
cargo.arg(if mode != Mode::Std {
1367+
"-Zcheck-cfg=names,values,features"
1368+
} else {
1369+
"-Zcheck-cfg=names,values"
1370+
});
1371+
1372+
// Add extra cfg not defined in/by rustc
13641373
//
1365-
// FIXME: Re-enable this after the beta bump as apperently rustc-perf doesn't use the
1366-
// beta cargo. See https://github.com/rust-lang/rust/pull/96984#issuecomment-1126678773
1367-
// #[cfg(not(bootstrap))]
1368-
// if mode != Mode::Std {
1369-
// cargo.arg("-Zcheck-cfg-features"); // -Zcheck-cfg=features after bump
1370-
// }
1371-
1372-
// Enable cfg checking of well known names/values
1373-
rustflags
1374-
.arg("-Zunstable-options")
1375-
// Enable checking of well known names
1376-
.arg("--check-cfg=names()")
1377-
// Enable checking of well known values
1378-
.arg("--check-cfg=values()");
1379-
1380-
// Add extra cfg not defined in rustc
1374+
// Note: Altrough it would seems that "-Zunstable-options" to `rustflags` is useless as
1375+
// cargo would implicitly add it, it was discover that sometimes bootstrap only use
1376+
// `rustflags` without `cargo` making it required.
1377+
rustflags.arg("-Zunstable-options");
13811378
for (restricted_mode, name, values) in EXTRA_CHECK_CFGS {
13821379
if *restricted_mode == None || *restricted_mode == Some(mode) {
13831380
// Creating a string of the values by concatenating each value:

0 commit comments

Comments
 (0)