Skip to content

Commit de1ac44

Browse files
committed
Remove the check_cfg job
check-cfg was stabilized in 1.80, so there is no longer any need to have a specific job and environment variable to enable it only under certain conditions. (backport <#4312>) (cherry picked from commit 2065a4a)
1 parent 4cf0dd7 commit de1ac44

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

.github/workflows/ci.yaml

-13
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,6 @@ jobs:
204204
export PATH=$HOME/.rust_solaris/bin:$PATH
205205
./ci/run.sh ${{ matrix.target }}
206206
207-
check_cfg:
208-
name: "Check #[cfg]s"
209-
runs-on: ubuntu-24.04
210-
env:
211-
TOOLCHAIN: nightly
212-
timeout-minutes: 10
213-
steps:
214-
- uses: actions/checkout@v4
215-
- name: Setup Rust toolchain
216-
run: ./ci/install-rust.sh
217-
- name: Build with check-cfg
218-
run: LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg
219-
220207
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
221208
# protection, rather than having to add each job separately.
222209
success:

build.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ fn main() {
4444
let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly();
4545
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4646
let libc_ci = env::var("LIBC_CI").is_ok();
47-
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
4847

4948
// The ABI of libc used by std is backward compatible with FreeBSD 12.
5049
// The ABI of libc from crates.io is backward compatible with FreeBSD 11.
@@ -100,12 +99,9 @@ fn main() {
10099
// Set unconditionally when ctest is not being invoked.
101100
set_cfg("libc_const_extern_fn");
102101

103-
// check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the
104-
// codebase. libc can configure it if the appropriate environment variable is passed. Since
105-
// rust-lang/rust enforces it, this is useful when using a custom libc fork there.
106-
//
107-
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
108-
if libc_check_cfg {
102+
// Since Rust 1.80, configuration that isn't recognized by default needs to be provided to
103+
// avoid warnings.
104+
if rustc_minor_ver >= 80 {
109105
for cfg in ALLOWED_CFGS {
110106
if rustc_minor_ver >= 75 {
111107
println!("cargo:rustc-check-cfg=cfg({})", cfg);

0 commit comments

Comments
 (0)