From 1c62c836a201952f1caddd9e162056f9b5a729ce Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 17 Aug 2026 22:30:51 -0700 Subject: [PATCH 1/5] Completely remove `rustc_attrs`. rustix's use of `rustc_*` attributes was already behind a `--cfg` flag, but that flag is enabled in solme CI rules, and it appears rustc is no longer accepting user code using those attributes, so just comment them out entirely. --- Cargo.toml | 1 - build.rs | 2 - src/backend/linux_raw/io/errno.rs | 6 +-- src/lib.rs | 1 - src/maybe_polyfill/no_std/os/fd/owned.rs | 12 +++--- .../no_std/os/windows/io/socket.rs | 40 +++++++++---------- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1bc6d5003..816f54519 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -264,7 +264,6 @@ check-cfg = [ 'cfg(lower_upper_exp_for_non_zero)', 'cfg(sanitize_memory)', 'cfg(netbsdlike)', - 'cfg(rustc_attrs)', 'cfg(rustc_diagnostics)', 'cfg(solarish)', 'cfg(staged_api)', diff --git a/build.rs b/build.rs index 8bc77643a..5d7969e1e 100644 --- a/build.rs +++ b/build.rs @@ -62,10 +62,8 @@ fn main() { // If experimental features are enabled, auto-detect and use available // features. if rustc_dep_of_std { - use_feature("rustc_attrs"); use_feature("core_intrinsics"); } else if rustix_use_experimental_features { - use_feature_or_nothing("rustc_attrs"); use_feature_or_nothing("core_intrinsics"); } diff --git a/src/backend/linux_raw/io/errno.rs b/src/backend/linux_raw/io/errno.rs index 4ddf6df5f..895a4b662 100644 --- a/src/backend/linux_raw/io/errno.rs +++ b/src/backend/linux_raw/io/errno.rs @@ -8,7 +8,7 @@ //! Linux uses error codes in `-4095..0`; we use rustc attributes to describe //! this restricted range of values. #![allow(unsafe_code)] -#![cfg_attr(not(rustc_attrs), allow(unused_unsafe))] +#![allow(unused_unsafe)] use crate::backend::c; use crate::backend::fd::RawFd; @@ -46,8 +46,8 @@ use linux_raw_sys::errno; #[derive(Eq, PartialEq, Hash, Copy, Clone)] // Linux returns negated error codes, and we leave them in negated form, so // error codes are in `-4095..0`. -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0xf001))] -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xffff))] +//#[rustc_layout_scalar_valid_range_start(0xf001)] +//#[rustc_layout_scalar_valid_range_end(0xffff)] pub struct Errno(u16); impl Errno { diff --git a/src/lib.rs b/src/lib.rs index b04dcb127..c8d000332 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,7 +99,6 @@ #![deny(missing_docs)] #![allow(stable_features)] #![cfg_attr(linux_raw, deny(unsafe_code))] -#![cfg_attr(rustc_attrs, feature(rustc_attrs))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))] #![cfg_attr(core_ffi_c, feature(core_ffi_c))] diff --git a/src/maybe_polyfill/no_std/os/fd/owned.rs b/src/maybe_polyfill/no_std/os/fd/owned.rs index b6aea61a4..ca9b05f31 100644 --- a/src/maybe_polyfill/no_std/os/fd/owned.rs +++ b/src/maybe_polyfill/no_std/os/fd/owned.rs @@ -37,12 +37,12 @@ use core::mem::forget; /// instead, but this is not supported on all platforms. #[derive(Copy, Clone)] #[repr(transparent)] -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))] +//#[rustc_layout_scalar_valid_range_start(0)] // libstd/os/raw/mod.rs assures me that every libstd-supported platform has a // 32-bit c_int. Below is -2, in two's complement, but that only works out // because c_int is 32 bits. -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))] -#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)] +//#[rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)] +//#[rustc_nonnull_optimization_guaranteed] #[cfg_attr(staged_api, stable(feature = "io_safety", since = "1.63.0"))] pub struct BorrowedFd<'fd> { fd: RawFd, @@ -61,13 +61,13 @@ pub struct BorrowedFd<'fd> { /// /// You can use [`AsFd::as_fd`] to obtain a [`BorrowedFd`]. #[repr(transparent)] -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))] +//#[rustc_layout_scalar_valid_range_start(0)] // libstd/os/raw/mod.rs assures me that every libstd-supported platform has a // 32-bit c_int. Below is -2, in two's complement, but that only works out // because c_int is 32 bits. -#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))] +//#[rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)] #[cfg_attr(staged_api, unstable(feature = "io_safety", issue = "87074"))] -#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)] +//#[rustc_nonnull_optimization_guaranteed] pub struct OwnedFd { fd: RawFd, } diff --git a/src/maybe_polyfill/no_std/os/windows/io/socket.rs b/src/maybe_polyfill/no_std/os/windows/io/socket.rs index 87692b37f..6bb472bc6 100644 --- a/src/maybe_polyfill/no_std/os/windows/io/socket.rs +++ b/src/maybe_polyfill/no_std/os/windows/io/socket.rs @@ -26,17 +26,17 @@ use core::mem::forget; /// socket, which is then borrowed under the same lifetime. #[derive(Copy, Clone)] #[repr(transparent)] -#[cfg_attr(staged_api, rustc_layout_scalar_valid_range_start(0))] +//#[rustc_layout_scalar_valid_range_start(0)] // This is -2, in two's complement. -1 is `INVALID_SOCKET`. -#[cfg_attr( - all(staged_api, target_pointer_width = "32"), - rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE) -)] -#[cfg_attr( - all(staged_api, target_pointer_width = "64"), - rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE) -)] -#[cfg_attr(staged_api, rustc_nonnull_optimization_guaranteed)] +//#[cfg_attr( +// target_pointer_width = "32", +// rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE) +//)] +//#[cfg_attr( +// target_pointer_width = "64", +// rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE) +//)] +//#[rustc_nonnull_optimization_guaranteed] #[cfg_attr(staged_api, stable(feature = "io_safety", since = "1.63.0"))] pub struct BorrowedSocket<'socket> { socket: RawSocket, @@ -52,17 +52,17 @@ pub struct BorrowedSocket<'socket> { /// argument or returned as an owned value, and it never has the value /// `INVALID_SOCKET`. #[repr(transparent)] -#[cfg_attr(staged_api, rustc_layout_scalar_valid_range_start(0))] +//#[rustc_layout_scalar_valid_range_start(0)] // This is -2, in two's complement. -1 is `INVALID_SOCKET`. -#[cfg_attr( - all(staged_api, target_pointer_width = "32"), - rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE) -)] -#[cfg_attr( - all(staged_api, target_pointer_width = "64"), - rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE) -)] -#[cfg_attr(staged_api, rustc_nonnull_optimization_guaranteed)] +//#[cfg_attr( +// target_pointer_width = "32", +// rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE) +//)] +//#[cfg_attr( +// target_pointer_width = "64", +// rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE) +//)] +//#[rustc_nonnull_optimization_guaranteed] #[cfg_attr(staged_api, stable(feature = "io_safety", since = "1.63.0"))] pub struct OwnedSocket { socket: RawSocket, From a79039f62f99e77a6258b425a3284c07f0e482cb Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 18 Aug 2026 05:07:52 -0700 Subject: [PATCH 2/5] Temporarily disable testing with `--cfg rustix_use_experimental_features`. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17597e00c..6abf0468d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -271,7 +271,8 @@ jobs: env: QEMU_BUILD_VERSION: 9.2.0 # Enabling testing of experimental features. - RUSTFLAGS: --cfg rustix_use_experimental_features + # TODO: Re-enable this once the fix for `rustc_attrs` is published. + # RUSTFLAGS: --cfg rustix_use_experimental_features strategy: matrix: build: From f14e38ecce8a391b717d2d7e453e7d48223ae7c8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 18 Aug 2026 05:08:13 -0700 Subject: [PATCH 3/5] Avoid using features on Dragonfly the `libc` crate no longer provides. --- src/backend/libc/net/sockopt.rs | 6 +++--- src/net/sockopt.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/libc/net/sockopt.rs b/src/backend/libc/net/sockopt.rs index 0a8541461..0f2e67b99 100644 --- a/src/backend/libc/net/sockopt.rs +++ b/src/backend/libc/net/sockopt.rs @@ -652,7 +652,7 @@ pub(crate) fn set_ip_add_membership_with_ifindex( setsockopt(fd, c::IPPROTO_IP, c::IP_ADD_MEMBERSHIP, mreqn) } -#[cfg(any(apple, freebsdlike, linux_like, solarish, target_os = "aix"))] +#[cfg(any(apple, target_os = "freebsd", linux_like, solarish, target_os = "aix"))] #[inline] pub(crate) fn set_ip_add_source_membership( fd: BorrowedFd<'_>, @@ -664,7 +664,7 @@ pub(crate) fn set_ip_add_source_membership( setsockopt(fd, c::IPPROTO_IP, c::IP_ADD_SOURCE_MEMBERSHIP, mreq_source) } -#[cfg(any(apple, freebsdlike, linux_like, solarish, target_os = "aix"))] +#[cfg(any(apple, target_os = "freebsd", linux_like, solarish, target_os = "aix"))] #[inline] pub(crate) fn set_ip_drop_source_membership( fd: BorrowedFd<'_>, @@ -1324,7 +1324,7 @@ fn to_ip_mreqn(multiaddr: &Ipv4Addr, address: &Ipv4Addr, ifindex: i32) -> c::ip_ } } -#[cfg(any(apple, freebsdlike, linux_like, solarish, target_os = "aix"))] +#[cfg(any(apple, target_os = "freebsd", linux_like, solarish, target_os = "aix"))] #[inline] fn to_imr_source( multiaddr: &Ipv4Addr, diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs index 20cbbefe5..9536e175d 100644 --- a/src/net/sockopt.rs +++ b/src/net/sockopt.rs @@ -1079,7 +1079,7 @@ pub fn set_ip_add_membership_with_ifindex( /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_ip_-and-set_ip_-functions -#[cfg(any(apple, freebsdlike, linux_like, solarish, target_os = "aix"))] +#[cfg(any(apple, target_os = "freebsd", linux_like, solarish, target_os = "aix"))] #[inline] #[doc(alias = "IP_ADD_SOURCE_MEMBERSHIP")] pub fn set_ip_add_source_membership( @@ -1101,7 +1101,7 @@ pub fn set_ip_add_source_membership( /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_ip_-and-set_ip_-functions -#[cfg(any(apple, freebsdlike, linux_like, solarish, target_os = "aix"))] +#[cfg(any(apple, target_os = "freebsd", linux_like, solarish, target_os = "aix"))] #[inline] #[doc(alias = "IP_DROP_SOURCE_MEMBERSHIP")] pub fn set_ip_drop_source_membership( From 59288580c363c3aba9d9dc7f6bf7ab0998372a28 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 18 Aug 2026 05:13:26 -0700 Subject: [PATCH 4/5] Temporarily disable espidf in CI. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6abf0468d..37b3e4a91 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -249,7 +249,8 @@ jobs: - run: cargo check -Z build-std --target x86_64-unknown-haiku --all-targets --features=all-apis # Temporarily disable due to build errors on nightly. # - run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis - - run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis + # Temporarily disable due to build errors on nightly. + # - run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis - run: cargo check -Z build-std --target=aarch64-unknown-nto-qnx710 --features=all-apis - run: cargo check -Z build-std --target=x86_64-pc-nto-qnx710 --features=all-apis # Temporarily disable due to build errors on nightly. From a7797ea72d7a22a4d3c23f54c01be05cc5bc86c5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 18 Aug 2026 05:19:53 -0700 Subject: [PATCH 5/5] Temporarily disable mips64el-unknown-linux-gnuabi64 in CI. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37b3e4a91..31fdb8ed4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -260,7 +260,8 @@ jobs: # Temporarily disable due to build errors on nightly. # - run: cargo check -Z build-std --target=powerpc64-ibm-aix --features=all-apis - run: cargo check -Z build-std --target=mipsel-unknown-linux-gnu --features=all-apis - - run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis + # Temporarily disable due to build errors on nightly. + # - run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis - run: cargo check -Z build-std --target=powerpc-unknown-linux-musl --features=all-apis - run: cargo check -Z build-std --target=powerpc64le-unknown-linux-musl --features=all-apis - run: cargo check -Z build-std --target=armv7k-apple-watchos --features=all-apis