Skip to content

Set LIBC_CHECK_CFG=1 when building Rust code in bootstrap #108898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
@@ -1718,6 +1718,15 @@ impl<'a> Builder<'a> {

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

// Downstream forks of the Rust compiler might want to use a custom libc to add support for
// targets that are not yet available upstream. Adding a patch to replace libc with a
// custom one would cause compilation errors though, because Cargo would interpret the
// custom libc as part of the workspace, and apply the check-cfg lints on it.
//
// The libc build script emits check-cfg flags only when this environment variable is set,
// so this line allows the use of custom libcs.
cargo.env("LIBC_CHECK_CFG", "1");

if source_type == SourceType::InTree {
let mut lint_flags = Vec::new();
// When extending this list, add the new lints to the RUSTFLAGS of the