From ce481838dcbe4b674d7f0854d7af33f6853c15e4 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Tue, 29 Oct 2024 16:01:10 +0100 Subject: [PATCH 1/4] Don't store build check rmeta (#1200) This ensures the `.rmeta` files generated by `can_compile` are not written to the build output. Those metadata files can create determinism and cache invalidation issues in some build systems. Instead the output -- since it is never actually read -- is written to `/dev/null`. --- build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index cac0aeb36..5b92f070b 100644 --- a/build.rs +++ b/build.rs @@ -205,7 +205,6 @@ fn has_feature(feature: &str) -> bool { fn can_compile>(test: T) -> bool { use std::process::Stdio; - let out_dir = var("OUT_DIR").unwrap(); let rustc = var("RUSTC").unwrap(); let target = var("TARGET").unwrap(); @@ -229,8 +228,9 @@ fn can_compile>(test: T) -> bool { .arg("--emit=metadata") // Do as little as possible but still parse. .arg("--target") .arg(target) - .arg("--out-dir") - .arg(out_dir); // Put the output somewhere inconsequential. + .arg("-o") + .arg("-") + .stdout(Stdio::null()); // We don't care about the output (only whether it builds or not) // If Cargo wants to set RUSTFLAGS, use that. if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") { From 1d49bb2194c40f5623ba72c7bee6702341978a6d Mon Sep 17 00:00:00 2001 From: Colin D Murphy Date: Mon, 4 Nov 2024 15:26:10 -0500 Subject: [PATCH 2/4] fix: enable wasip2 feature for wasm32-wasip2 target (#1205) * fix: enable wasip2 feature for wasm32-wasip2 target Signed-off-by: Colin Murphy * Do not change MSRV --------- Signed-off-by: Colin Murphy --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index e53e263ab..aee4005a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +// wasip2 conditionally gates stdlib APIs. +// https://github.com/rust-lang/rust/issues/130323 +#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))] //! `rustix` provides efficient memory-safe and [I/O-safe] wrappers to //! POSIX-like, Unix-like, Linux, and Winsock syscall-like APIs, with //! configurable backends. From ad3fae629d44664516377eedd19aa5066fd10c28 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 4 Nov 2024 14:43:21 -0800 Subject: [PATCH 3/4] Enable a few features on more platforms. (#1203) * Enable a few features on more platforms. Define `PollFlags::RDHUP` on FreeBSD, `AT_EACCESS` on Emscripten, and `ptsname` on Illumos. * Enable `epoll` on solarish. --- src/backend/libc/conv.rs | 6 +++++- src/backend/libc/event/mod.rs | 2 +- src/backend/libc/event/poll_fd.rs | 12 ++++++++---- src/backend/libc/event/syscalls.rs | 14 +++++++------- src/backend/libc/fs/types.rs | 2 +- src/backend/libc/pty/syscalls.rs | 18 +++++++++++++++--- src/event/mod.rs | 2 +- src/pty.rs | 16 ++++++++++++++-- 8 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/backend/libc/conv.rs b/src/backend/libc/conv.rs index 5052b010f..f4b440b7a 100644 --- a/src/backend/libc/conv.rs +++ b/src/backend/libc/conv.rs @@ -70,7 +70,11 @@ pub(super) fn ret_c_int(raw: c::c_int) -> io::Result { } } -#[cfg(any(linux_kernel, all(target_os = "redox", feature = "event")))] +#[cfg(any( + linux_kernel, + all(solarish, feature = "event"), + all(target_os = "redox", feature = "event") +))] #[inline] pub(super) fn ret_u32(raw: c::c_int) -> io::Result { if raw == -1 { diff --git a/src/backend/libc/event/mod.rs b/src/backend/libc/event/mod.rs index a07d06b1a..23797dd78 100644 --- a/src/backend/libc/event/mod.rs +++ b/src/backend/libc/event/mod.rs @@ -5,5 +5,5 @@ pub(crate) mod types; #[cfg_attr(windows, path = "windows_syscalls.rs")] pub(crate) mod syscalls; -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub mod epoll; diff --git a/src/backend/libc/event/poll_fd.rs b/src/backend/libc/event/poll_fd.rs index ba1bab0b5..1b0d4ae1f 100644 --- a/src/backend/libc/event/poll_fd.rs +++ b/src/backend/libc/event/poll_fd.rs @@ -40,10 +40,14 @@ bitflags! { #[cfg(not(target_os = "espidf"))] const NVAL = c::POLLNVAL; /// `POLLRDHUP` - #[cfg(all( - linux_kernel, - not(any(target_arch = "sparc", target_arch = "sparc64"))), - )] + #[cfg(any( + target_os = "freebsd", + target_os = "illumos", + all( + linux_kernel, + not(any(target_arch = "sparc", target_arch = "sparc64")) + ), + ))] const RDHUP = c::POLLRDHUP; /// diff --git a/src/backend/libc/event/syscalls.rs b/src/backend/libc/event/syscalls.rs index 763f2e2c0..2f55dfb81 100644 --- a/src/backend/libc/event/syscalls.rs +++ b/src/backend/libc/event/syscalls.rs @@ -5,7 +5,7 @@ use crate::backend::c; use crate::backend::conv::ret; use crate::backend::conv::ret_c_int; #[cfg(feature = "alloc")] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] use crate::backend::conv::ret_u32; #[cfg(solarish)] use crate::event::port::Event; @@ -22,7 +22,7 @@ use crate::event::PollFd; use crate::io; #[cfg(solarish)] use crate::utils::as_mut_ptr; -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] use crate::utils::as_ptr; #[cfg(any( all(feature = "alloc", bsd), @@ -351,13 +351,13 @@ pub(crate) fn pause() { } #[inline] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub(crate) fn epoll_create(flags: super::epoll::CreateFlags) -> io::Result { unsafe { ret_owned_fd(c::epoll_create1(bitflags_bits!(flags))) } } #[inline] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub(crate) fn epoll_add( epoll: BorrowedFd<'_>, source: BorrowedFd<'_>, @@ -378,7 +378,7 @@ pub(crate) fn epoll_add( } #[inline] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub(crate) fn epoll_mod( epoll: BorrowedFd<'_>, source: BorrowedFd<'_>, @@ -396,7 +396,7 @@ pub(crate) fn epoll_mod( } #[inline] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub(crate) fn epoll_del(epoll: BorrowedFd<'_>, source: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(c::epoll_ctl( @@ -410,7 +410,7 @@ pub(crate) fn epoll_del(epoll: BorrowedFd<'_>, source: BorrowedFd<'_>) -> io::Re #[inline] #[cfg(feature = "alloc")] -#[cfg(any(linux_kernel, target_os = "redox"))] +#[cfg(any(linux_kernel, solarish, target_os = "redox"))] pub(crate) fn epoll_wait( epoll: BorrowedFd<'_>, events: &mut [MaybeUninit], diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index 98b767cd4..c8bb01f46 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -40,7 +40,7 @@ bitflags! { const SYMLINK_NOFOLLOW = bitcast!(c::AT_SYMLINK_NOFOLLOW); /// `AT_EACCESS` - #[cfg(not(any(target_os = "emscripten", target_os = "android")))] + #[cfg(not(target_os = "android"))] const EACCESS = bitcast!(c::AT_EACCESS); /// `AT_REMOVEDIR` diff --git a/src/backend/libc/pty/syscalls.rs b/src/backend/libc/pty/syscalls.rs index 2395efde4..4e8af7509 100644 --- a/src/backend/libc/pty/syscalls.rs +++ b/src/backend/libc/pty/syscalls.rs @@ -6,7 +6,13 @@ use crate::fd::BorrowedFd; use crate::io; #[cfg(all( feature = "alloc", - any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia") + any( + apple, + linux_like, + target_os = "freebsd", + target_os = "fuchsia", + target_os = "illumos" + ) ))] use { crate::ffi::{CStr, CString}, @@ -26,7 +32,13 @@ pub(crate) fn openpt(flags: OpenptFlags) -> io::Result { #[cfg(all( feature = "alloc", - any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia") + any( + apple, + linux_like, + target_os = "freebsd", + target_os = "fuchsia", + target_os = "illumos" + ) ))] #[inline] pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec) -> io::Result { @@ -38,7 +50,7 @@ pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec) -> io::Result io::Result { /// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Allocation.html#index-ptsname #[cfg(all( feature = "alloc", - any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia") + any( + apple, + linux_like, + target_os = "freebsd", + target_os = "fuchsia", + target_os = "illumos" + ) ))] #[inline] #[doc(alias = "ptsname_r")] From 988e67f90975d531c9b422a1554408391469c328 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 4 Nov 2024 15:13:20 -0800 Subject: [PATCH 4/4] Update CI to macos-13. (#1207) Drop macos-12, which is now deprecated, and add macos-13. At this time, macos-latest is macos-14. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba82e72e5..8a7617c63 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -237,7 +237,7 @@ jobs: RUSTFLAGS: --cfg rustix_use_experimental_features strategy: matrix: - build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-12, windows, windows-2019, musl] + build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-13, windows, windows-2019, musl] include: - build: ubuntu os: ubuntu-latest @@ -410,8 +410,8 @@ jobs: - build: macos-latest os: macos-latest rust: stable - - build: macos-12 - os: macos-12 + - build: macos-13 + os: macos-13 rust: stable - build: windows os: windows-latest