From c988b9a2eae5d08d666e749d3b4142b14f3ae2ba Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sat, 14 Mar 2026 17:26:51 +0000 Subject: [PATCH] Increase the MSRV from 1.63 to 1.65 --- .github/workflows/main.yml | 90 ++++++++++++++++++-------------------- Cargo.toml | 3 +- README.md | 12 ++--- build.rs | 10 ----- src/lib.rs | 7 +-- src/static_assertions.rs | 36 --------------- 6 files changed, 51 insertions(+), 107 deletions(-) delete mode 100644 src/static_assertions.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0955f7683..af47c6db4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - build: [stable, nightly, 1.63] + build: [stable, nightly, 1.65] include: - build: stable os: ubuntu-latest @@ -33,9 +33,9 @@ jobs: - build: nightly os: ubuntu-latest rust: nightly - - build: 1.63 + - build: 1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 env: # -D warnings is commented out in our install-rust action; re-add it here. @@ -48,19 +48,16 @@ jobs: with: toolchain: ${{ matrix.rust }} - - name: Use specific dependency versions for Rust 1.63 compatibility. - if: matrix.rust == '1.63' + - name: Use specific dependency versions for Rust 1.65 compatibility. + if: matrix.rust == '1.65' run: | - cargo update --package=dashmap --precise 5.4.0 - cargo update --package=regex --precise=1.9.0 cargo update --package=half --precise=2.2.1 cargo update --package=flate2 --precise=1.0.35 cargo update --package=syn --precise=2.0.106 cargo update --package=textwrap --precise=0.16.1 - cargo update --package=once_cell --precise=1.20.3 - cargo update --package=parking_lot --precise=0.12.3 - cargo update --package=parking_lot_core --precise=0.9.10 - cargo update --package=lock_api --precise=0.4.12 + cargo update --package=parking_lot --precise=0.12.4 + cargo update --package=parking_lot_core --precise=0.9.11 + cargo update --package=lock_api --precise=0.4.13 cargo update --package=rayon --precise=1.10.0 cargo update --package=rayon-core --precise=1.12.1 cargo update --package=windows-sys --precise=0.60.2 @@ -107,13 +104,13 @@ jobs: aarch64-linux-android aarch64-apple-ios i686-pc-windows-msvc - - if: matrix.rust != '1.63' + - if: matrix.rust != '1.65' run: > rustup target add wasm32-wasip1 wasm32-wasip2 x86_64-unknown-fuchsia - - if: matrix.rust == '1.63' + - if: matrix.rust == '1.65' run: rustup target add x86_64-fuchsia - run: cargo check --workspace --release -vv --all-targets @@ -129,13 +126,13 @@ jobs: - run: cargo check --workspace --release -vv --target=x86_64-apple-darwin --features=all-apis --all-targets - run: cargo check --workspace --release -vv --target=x86_64-unknown-freebsd --features=all-apis --all-targets - run: cargo check --workspace --release -vv --target=x86_64-unknown-netbsd --features=all-apis --all-targets - - if: matrix.rust != '1.63' + - if: matrix.rust != '1.65' run: cargo check --workspace --release -vv --target=wasm32-wasip1 --features=all-apis - - if: matrix.rust != '1.63' + - if: matrix.rust != '1.65' run: cargo check --workspace --release -vv --target=wasm32-wasip2 --features=all-apis - - if: matrix.rust != '1.63' + - if: matrix.rust != '1.65' run: cargo check --workspace --release -vv --target=x86_64-unknown-fuchsia --features=all-apis --all-targets - - if: matrix.rust == '1.63' + - if: matrix.rust == '1.65' run: cargo check --workspace --release -vv --target=x86_64-fuchsia --features=all-apis --all-targets - run: cargo check --workspace --release -vv --target=x86_64-unknown-illumos --features=all-apis --all-targets - run: cargo check --workspace --release -vv --target=i686-unknown-linux-gnu --features=all-apis --all-targets @@ -291,14 +288,14 @@ jobs: powerpc-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, + ubuntu-1.65, + i686-linux-1.65, + aarch64-linux-1.65, + riscv64-linux-1.65, + s390x-linux-1.65, powerpc64le-linux, - powerpc64le-linux-1.63, - arm-linux-1.63, + powerpc64le-linux-1.65, + arm-linux-1.65, macos-latest, macos-15-intel, macos-14, @@ -437,64 +434,64 @@ jobs: qemu: qemu-arm qemu_args: -L /usr/arm-linux-gnueabi qemu_target: arm-linux-user - - build: ubuntu-1.63 + - build: ubuntu-1.65 os: ubuntu-latest - rust: 1.63 - - build: i686-linux-1.63 + rust: 1.65 + - build: i686-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: i686-unknown-linux-gnu gcc_package: gcc-i686-linux-gnu gcc: i686-linux-gnu-gcc libc_package: libc-dev-i386-cross - - build: aarch64-linux-1.63 + - build: aarch64-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: aarch64-unknown-linux-gnu gcc_package: gcc-aarch64-linux-gnu gcc: aarch64-linux-gnu-gcc qemu: qemu-aarch64 qemu_args: -L /usr/aarch64-linux-gnu qemu_target: aarch64-linux-user - - build: riscv64-linux-1.63 + - build: riscv64-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: riscv64gc-unknown-linux-gnu gcc_package: gcc-riscv64-linux-gnu gcc: riscv64-linux-gnu-gcc qemu: qemu-riscv64 qemu_args: -L /usr/riscv64-linux-gnu qemu_target: riscv64-linux-user - - build: s390x-linux-1.63 + - build: s390x-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: s390x-unknown-linux-gnu gcc_package: gcc-s390x-linux-gnu gcc: s390x-linux-gnu-gcc qemu: qemu-s390x qemu_args: -L /usr/s390x-linux-gnu qemu_target: s390x-linux-user - - build: powerpc-linux-1.63 + - build: powerpc-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: powerpc-unknown-linux-gnu gcc_package: gcc-powerpc-linux-gnu gcc: powerpc-linux-gnu-gcc qemu: qemu-ppc qemu_args: -L /usr/powerpc-linux-gnu qemu_target: ppc-linux-user - - build: powerpc64le-linux-1.63 + - build: powerpc64le-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: powerpc64le-unknown-linux-gnu gcc_package: gcc-powerpc64le-linux-gnu gcc: powerpc64le-linux-gnu-gcc qemu: qemu-ppc64le qemu_args: -L /usr/powerpc64le-linux-gnu qemu_target: ppc64le-linux-user - - build: arm-linux-1.63 + - build: arm-linux-1.65 os: ubuntu-latest - rust: 1.63 + rust: 1.65 target: armv5te-unknown-linux-gnueabi gcc_package: gcc-arm-linux-gnueabi gcc: arm-linux-gnueabi-gcc @@ -585,19 +582,16 @@ jobs: ninja -C build install if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' - - name: Use specific dependency versions for Rust 1.63 compatibility. - if: matrix.rust == '1.63' + - name: Use specific dependency versions for Rust 1.65 compatibility. + if: matrix.rust == '1.65' run: | - cargo update --package=dashmap --precise 5.4.0 - cargo update --package=regex --precise=1.9.0 cargo update --package=half --precise=2.2.1 cargo update --package=flate2 --precise=1.0.35 cargo update --package=syn --precise=2.0.106 cargo update --package=textwrap --precise=0.16.1 - cargo update --package=once_cell --precise=1.20.3 - cargo update --package=parking_lot --precise=0.12.3 - cargo update --package=parking_lot_core --precise=0.9.10 - cargo update --package=lock_api --precise=0.4.12 + cargo update --package=parking_lot --precise=0.12.4 + cargo update --package=parking_lot_core --precise=0.9.11 + cargo update --package=lock_api --precise=0.4.13 cargo update --package=rayon --precise=1.10.0 cargo update --package=rayon-core --precise=1.12.1 cargo update --package=windows-sys --precise=0.60.2 diff --git a/Cargo.toml b/Cargo.toml index bfacfeb95..1bc6d5003 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" keywords = ["api", "file", "network", "safe", "syscall"] categories = ["os::unix-apis", "date-and-time", "filesystem", "network-programming"] include = ["src", "build.rs", "Cargo.toml", "COPYRIGHT", "LICENSE*", "/*.md", "benches"] -rust-version = "1.63" +rust-version = "1.65" [hints] # Most users use a fraction of the rustix API surface area, so this reduces compilation times @@ -268,7 +268,6 @@ check-cfg = [ 'cfg(rustc_diagnostics)', 'cfg(solarish)', 'cfg(staged_api)', - 'cfg(static_assertions)', 'cfg(thumb_mode)', 'cfg(wasi)', 'cfg(wasi_ext)', diff --git a/README.md b/README.md index 3e553b30d..e5bdeb957 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ more portable APIs built on this functionality, see the [`cap-std`], [`memfd`], * linux_raw, which uses raw Linux system calls and vDSO calls, and is supported on Linux on x86-64, x86, aarch64, riscv64gc, powerpc64le, - arm (v5 onwards), mipsel, and mips64el, with stable, nightly, and 1.63 Rust. + arm (v5 onwards), mipsel, and mips64el, with stable, nightly, and 1.65 Rust. - By being implemented entirely in Rust, avoiding `libc`, `errno`, and pthread cancellation, and employing some specialized optimizations, most functions compile down to very efficient code, which can often be fully inlined into @@ -157,9 +157,11 @@ safety types rather than `RawFd`, and the flags parameters to functions such as ## Minimum Supported Rust Version (MSRV) -This crate currently works on the version of [Rust on Debian stable], which is -currently [Rust 1.63]. This policy may change in the future, in minor version -releases, so users using a fixed version of Rust should pin to a specific +This crate has a Minimum Supported Rust Version (MSRV) of [Rust 1.65]. + +The MSRV may change in future minor versions; however, the current policy is +that it will not be increased beyond the version of [Rust on Debian stable]. +Users who rely on a fixed version of Rust should pin to a specific version of this crate. ## Minimum Linux Version @@ -172,7 +174,7 @@ The specifics of this policy may change in the future, but we intend it to always reflect “very old” Linux versions. [MSRV]: #minimum-supported-rust-version-msrv -[Rust 1.63]: https://blog.rust-lang.org/2022/08/11/Rust-1.63.0.html +[Rust 1.65]: https://blog.rust-lang.org/2022/11/03/Rust-1.65.0/ [any current Rust target]: https://doc.rust-lang.org/nightly/rustc/platform-support.html [kernel.org]: https://www.kernel.org/releases.html [Rust on Debian stable]: https://packages.debian.org/stable/rust/rustc diff --git a/build.rs b/build.rs index 1677ece45..8bc77643a 100644 --- a/build.rs +++ b/build.rs @@ -79,11 +79,6 @@ fn main() { use_feature_or_nothing("error_in_core"); } - // Feature needed for testing. - if use_static_assertions() { - use_feature("static_assertions"); - } - // `LowerExp`/`UpperExp` for `NonZeroI32` etc. if has_lower_upper_exp_for_non_zero() { use_feature("lower_upper_exp_for_non_zero"); @@ -197,11 +192,6 @@ fn main() { println!("cargo:rerun-if-env-changed=CARGO_CFG_MIRI"); } -fn use_static_assertions() -> bool { - // `offset_from` was made const in Rust 1.65. - can_compile("const unsafe fn foo(p: *const u8) -> isize { p.offset_from(p) }") -} - fn use_thumb_mode() -> bool { // In thumb mode, r7 is reserved. !can_compile("pub unsafe fn f() { core::arch::asm!(\"udf #16\", in(\"r7\") 0); }") diff --git a/src/lib.rs b/src/lib.rs index 8d4a5e521..c671dd14f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,15 +153,10 @@ extern crate rustc_std_workspace_alloc as alloc; #[cfg(all(feature = "alloc", not(feature = "rustc-dep-of-std")))] extern crate alloc; -// Use `static_assertions` macros if we have them, or a polyfill otherwise. -#[cfg(all(test, static_assertions))] +#[cfg(test)] #[macro_use] #[allow(unused_imports)] extern crate static_assertions; -#[cfg(all(test, not(static_assertions)))] -#[macro_use] -#[allow(unused_imports)] -mod static_assertions; pub mod buffer; #[cfg(not(windows))] diff --git a/src/static_assertions.rs b/src/static_assertions.rs deleted file mode 100644 index 3d0711811..000000000 --- a/src/static_assertions.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! Workarounds for Rust 1.63 where some things in the `static_assertions` -//! crate do things that don't work in const contexts. We want to call them in -//! const contexts in Rust versions where that's supported so that problems are -//! caught at compile time, and fall back to dynamic asserts in Rust 1.63. - -#![allow(unused_macros)] - -macro_rules! assert_eq_size { - ($x:ty, $y:ty) => { - assert_eq!(core::mem::size_of::<$x>(), core::mem::size_of::<$y>()); - }; -} - -macro_rules! assert_eq_align { - ($x:ty, $y:ty) => { - assert_eq!(core::mem::align_of::<$x>(), core::mem::align_of::<$y>()); - }; -} - -macro_rules! const_assert_eq { - ($x:expr, $y:expr) => { - assert_eq!($x, $y); - }; -} - -macro_rules! const_assert_ne { - ($x:expr, $y:expr) => { - assert_ne!($x, $y); - }; -} - -macro_rules! const_assert { - ($x:expr) => { - assert!($x); - }; -}