From 07bb6bfe7e1ef3bd8dcfeb4d9d66ea4584edfa4e Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 27 Oct 2023 12:37:34 +0200 Subject: [PATCH 1/2] Use new check-cfg syntax in newer nightly https://github.com/rust-lang/rust/issues/82450#issuecomment-1775354666 --- build.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); + } } } } From 63e1ce28cf9027f94a5f597268e56af189db1c81 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 27 Oct 2023 13:35:32 +0200 Subject: [PATCH 2/2] Remove all options to cargo -Zcheck-cfg They no longer exists: https://github.com/rust-lang/cargo/pull/12845 --- .github/workflows/bors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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