Skip to content
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

Use new check-cfg syntax in newer nightly #3410

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ jobs:
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly sh ./ci/install-rust.sh
- name: Build with check-cfg
run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg=features,names,values,output
run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg

# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
Expand Down
12 changes: 10 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,19 @@ fn main() {
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
if libc_check_cfg {
for cfg in ALLOWED_CFGS {
println!("cargo:rustc-check-cfg=values({})", cfg);
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({})", cfg);
} else {
println!("cargo:rustc-check-cfg=values({})", cfg);
}
}
for &(name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values);
} else {
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
}
}
}
}
Expand Down