Skip to content

Commit 3a8e713

Browse files
committed
Auto merge of #97529 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum
Use new cargo argument in bootstrap for cfg checking This PR use new cargo argument in bootstrap for doing cfg checking. Follow-up to #97044 and #97214. r? `@Mark-Simulacrum`
2 parents 6364179 + ff33001 commit 3a8e713

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
@@ -1364,29 +1364,26 @@ impl<'a> Builder<'a> {
13641364
// get some support for setting `--check-cfg` within build script, it's the least invasive
13651365
// hack that still let's us have cfg checking for the vast majority of the codebase.
13661366
if stage != 0 {
1367-
// Enable cfg checking of cargo features for everything but std.
1367+
// Enable cfg checking of cargo features for everything but std and also enable cfg
1368+
// checking of names and values.
13681369
//
13691370
// Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
1370-
// backtrace, core_simd, std_float, ...), those dependencies have their own features
1371-
// but cargo isn't involved in the #[path] and so cannot pass the complete list of
1372-
// features, so for that reason we don't enable checking of features for std.
1371+
// backtrace, core_simd, std_float, ...), those dependencies have their own
1372+
// features but cargo isn't involved in the #[path] process and so cannot pass the
1373+
// complete list of features, so for that reason we don't enable checking of
1374+
// features for std crates.
1375+
cargo.arg(if mode != Mode::Std {
1376+
"-Zcheck-cfg=names,values,features"
1377+
} else {
1378+
"-Zcheck-cfg=names,values"
1379+
});
1380+
1381+
// Add extra cfg not defined in/by rustc
13731382
//
1374-
// FIXME: Re-enable this after the beta bump as apperently rustc-perf doesn't use the
1375-
// beta cargo. See https://github.com/rust-lang/rust/pull/96984#issuecomment-1126678773
1376-
// #[cfg(not(bootstrap))]
1377-
// if mode != Mode::Std {
1378-
// cargo.arg("-Zcheck-cfg-features"); // -Zcheck-cfg=features after bump
1379-
// }
1380-
1381-
// Enable cfg checking of well known names/values
1382-
rustflags
1383-
.arg("-Zunstable-options")
1384-
// Enable checking of well known names
1385-
.arg("--check-cfg=names()")
1386-
// Enable checking of well known values
1387-
.arg("--check-cfg=values()");
1388-
1389-
// Add extra cfg not defined in rustc
1383+
// Note: Altrough it would seems that "-Zunstable-options" to `rustflags` is useless as
1384+
// cargo would implicitly add it, it was discover that sometimes bootstrap only use
1385+
// `rustflags` without `cargo` making it required.
1386+
rustflags.arg("-Zunstable-options");
13901387
for (restricted_mode, name, values) in EXTRA_CHECK_CFGS {
13911388
if *restricted_mode == None || *restricted_mode == Some(mode) {
13921389
// Creating a string of the values by concatenating each value:

0 commit comments

Comments
 (0)