Skip to content

Commit f3d2288

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.
1 parent 3914f82 commit f3d2288

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

build.rs

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

4847
// The ABI of libc used by std is backward compatible with FreeBSD 12.
4948
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
@@ -94,12 +93,9 @@ fn main() {
9493
// Set unconditionally when ctest is not being invoked.
9594
set_cfg("libc_const_extern_fn");
9695

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

0 commit comments

Comments
 (0)