Skip to content

Commit ead8b96

Browse files
committedMar 8, 2023
set LIBC_CHECK_CFG=1 when building Rust code in bootstrap
1 parent 64165aa commit ead8b96

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/bootstrap/builder.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,15 @@ impl<'a> Builder<'a> {
17181718

17191719
cargo.env("RUSTC_VERBOSE", self.verbosity.to_string());
17201720

1721+
// Downstream forks of the Rust compiler might want to use a custom libc to add support for
1722+
// targets that are not yet available upstream. Adding a patch to replace libc with a
1723+
// custom one would cause compilation errors though, because Cargo would interpret the
1724+
// custom libc as part of the workspace, and apply the check-cfg lints on it.
1725+
//
1726+
// The libc build script emits check-cfg flags only when this environment variable is set,
1727+
// so this line allows the use of custom libcs.
1728+
cargo.env("LIBC_CHECK_CFG", "1");
1729+
17211730
if source_type == SourceType::InTree {
17221731
let mut lint_flags = Vec::new();
17231732
// When extending this list, add the new lints to the RUSTFLAGS of the

0 commit comments

Comments
 (0)
Please sign in to comment.