From fb245bb5eecdc405610e224dd38fa005fe19d0b8 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 18 Apr 2026 19:36:05 -0400 Subject: [PATCH] asm: bump MSRV to 1.95 and collapse arch dispatch with cfg_select! --- Cargo.toml | 2 +- crates/asm/src/lib.rs | 84 +++++++++--------------------------------- microfetch/src/main.rs | 2 - 3 files changed, 18 insertions(+), 70 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab63681..391e0dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "3" authors = [ "NotAShelf " ] edition = "2024" license = "GPL-3.0" -rust-version = "1.92.0" +rust-version = "1.95.0" version = "1.1.0" [workspace.dependencies] diff --git a/crates/asm/src/lib.rs b/crates/asm/src/lib.rs index a356f1c..fff8d7f 100644 --- a/crates/asm/src/lib.rs +++ b/crates/asm/src/lib.rs @@ -12,8 +12,6 @@ #![no_std] #![cfg_attr( any( - target_arch = "powerpc64", - target_arch = "powerpc", target_arch = "sparc64", target_arch = "sparc", target_arch = "mips64", @@ -22,72 +20,24 @@ feature(asm_experimental_arch) )] -// Ensure we're compiling for a supported architecture. -#[cfg(not(any( - target_arch = "x86_64", - target_arch = "aarch64", - target_arch = "riscv64", - target_arch = "loongarch64", - target_arch = "s390x", - target_arch = "powerpc64", - target_arch = "arm", - target_arch = "riscv32", - target_arch = "sparc64", - target_arch = "mips64", - target_arch = "x86", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "mips" -)))] -compile_error!( - "Unsupported architecture: only x86_64, aarch64, riscv64, loongarch64, \ - s390x, powerpc64, arm, riscv32, sparc64, mips64, x86, powerpc, sparc, and \ - mips are supported" -); - // Per-arch syscall implementations live in their own module files. -#[cfg(target_arch = "x86_64")] -#[path = "x86_64.rs"] -mod arch; -#[cfg(target_arch = "aarch64")] -#[path = "aarch64.rs"] -mod arch; -#[cfg(target_arch = "riscv64")] -#[path = "riscv64.rs"] -mod arch; -#[cfg(target_arch = "loongarch64")] -#[path = "loongarch64.rs"] -mod arch; -#[cfg(target_arch = "s390x")] -#[path = "s390x.rs"] -mod arch; -#[cfg(target_arch = "powerpc64")] -#[path = "powerpc64.rs"] -mod arch; -#[cfg(target_arch = "arm")] -#[path = "arm.rs"] -mod arch; -#[cfg(target_arch = "riscv32")] -#[path = "riscv32.rs"] -mod arch; -#[cfg(target_arch = "sparc64")] -#[path = "sparc64.rs"] -mod arch; -#[cfg(target_arch = "mips64")] -#[path = "mips64.rs"] -mod arch; -#[cfg(target_arch = "x86")] -#[path = "x86.rs"] -mod arch; -#[cfg(target_arch = "powerpc")] -#[path = "powerpc.rs"] -mod arch; -#[cfg(target_arch = "sparc")] -#[path = "sparc.rs"] -mod arch; -#[cfg(target_arch = "mips")] -#[path = "mips.rs"] -mod arch; +core::cfg_select! { + target_arch = "x86_64" => { #[path = "x86_64.rs" ] mod arch; } + target_arch = "aarch64" => { #[path = "aarch64.rs" ] mod arch; } + target_arch = "riscv64" => { #[path = "riscv64.rs" ] mod arch; } + target_arch = "loongarch64" => { #[path = "loongarch64.rs"] mod arch; } + target_arch = "s390x" => { #[path = "s390x.rs" ] mod arch; } + target_arch = "powerpc64" => { #[path = "powerpc64.rs" ] mod arch; } + target_arch = "arm" => { #[path = "arm.rs" ] mod arch; } + target_arch = "riscv32" => { #[path = "riscv32.rs" ] mod arch; } + target_arch = "sparc64" => { #[path = "sparc64.rs" ] mod arch; } + target_arch = "mips64" => { #[path = "mips64.rs" ] mod arch; } + target_arch = "x86" => { #[path = "x86.rs" ] mod arch; } + target_arch = "powerpc" => { #[path = "powerpc.rs" ] mod arch; } + target_arch = "sparc" => { #[path = "sparc.rs" ] mod arch; } + target_arch = "mips" => { #[path = "mips.rs" ] mod arch; } + _ => { compile_error!("Unsupported architecture"); } +} /// Copies `n` bytes from `src` to `dest`. /// diff --git a/microfetch/src/main.rs b/microfetch/src/main.rs index 9d135c3..d1b39b0 100644 --- a/microfetch/src/main.rs +++ b/microfetch/src/main.rs @@ -2,8 +2,6 @@ #![no_main] #![cfg_attr( any( - target_arch = "powerpc64", - target_arch = "powerpc", target_arch = "sparc64", target_arch = "sparc", target_arch = "mips64",