diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml index e171f7e6789e0..7c9c3680cb56f 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/bors.yml @@ -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 diff --git a/build.rs b/build.rs index 1bd9a8db514ab..d7a9b7f7811d2 100644 --- a/build.rs +++ b/build.rs @@ -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); + } } } }