From 0c5b026868692878528551fb312cf0fa1c02d99e Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Fri, 18 Sep 2026 17:56:48 +0100 Subject: [PATCH 1/2] build(rm): gate by target support The package now compiles successfully on more targets: ```sh RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std=std,panic_abort -p uu_rm --all-features --lib --target=powerpc64-ibm-aix --target=i686-linux-android --target=x86_64-pc-cygwin --target=aarch64-apple-darwin --target=x86_64-unknown-freebsd --target=x86_64-unknown-haiku --target=x86_64-unknown-hermit --target=x86_64-unknown-hurd-gnu --target=aarch64-unknown-illumos --target=x86_64-unknown-linux-gnu --target=i686-unknown-netbsd --target=x86_64-unknown-openbsd --target=x86_64-unknown-redox --target=x86_64-pc-solaris --target=wasm32-wasip1 --target=x86_64-pc-windows-gnu ``` --- src/uu/rm/Cargo.toml | 6 ++++-- src/uu/rm/benches/rm_bench.rs | 2 ++ src/uu/rm/src/rm.rs | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 23c840551d1..c2516e6c578 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -15,7 +15,7 @@ readme.workspace = true path = "src/rm.rs" doctest = false -[dependencies] +[target.'cfg(any(unix, windows, target_os = "wasi"))'.dependencies] clap = { workspace = true } fluent = { workspace = true } indicatif = { workspace = true } @@ -31,8 +31,9 @@ libc = { workspace = true } [[bin]] name = "rm" path = "src/main.rs" +required-features = ["uucore/default"] -[dev-dependencies] +[target.'cfg(any(unix, windows, target_os = "wasi"))'.dev-dependencies] divan = { workspace = true } tempfile = { workspace = true } uucore = { workspace = true, features = ["benchmark"] } @@ -43,3 +44,4 @@ workspace = true [[bench]] name = "rm_bench" harness = false +required-features = ["uucore/default"] diff --git a/src/uu/rm/benches/rm_bench.rs b/src/uu/rm/benches/rm_bench.rs index 31b62072a5f..3a888163bea 100644 --- a/src/uu/rm/benches/rm_bench.rs +++ b/src/uu/rm/benches/rm_bench.rs @@ -3,6 +3,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![cfg(any(unix, windows, target_os = "wasi"))] + use divan::{Bencher, black_box}; use tempfile::TempDir; use uu_rm::uumain; diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 63e23f30f62..f95e0f7ca1c 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -5,6 +5,8 @@ // spell-checker:ignore (path) eacces inacc rm-r4 unlinkat fstatat rootlink +#![cfg(any(unix, windows, target_os = "wasi"))] + use clap::builder::{PossibleValue, ValueParser}; use clap::{Arg, ArgAction, Command, parser::ValueSource}; use indicatif::{ProgressBar, ProgressStyle}; From 7d621560ee33d13e7f1dd1d314d67d59fefc5b0c Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sun, 18 Oct 2026 03:38:03 +0100 Subject: [PATCH 2/2] fixup! build(rm): gate by target support `.git-blame-ignore-revs` --- src/uu/rm/Cargo.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index c2516e6c578..e1871af2ac5 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -15,6 +15,9 @@ readme.workspace = true path = "src/rm.rs" doctest = false +[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies] +uucore = { workspace = true, features = ["safe-traversal"] } + [target.'cfg(any(unix, windows, target_os = "wasi"))'.dependencies] clap = { workspace = true } fluent = { workspace = true } @@ -22,8 +25,10 @@ indicatif = { workspace = true } thiserror = { workspace = true } uucore = { workspace = true, features = ["fs", "parser", "quoting-style"] } -[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies] -uucore = { workspace = true, features = ["safe-traversal"] } +[target.'cfg(any(unix, windows, target_os = "wasi"))'.dev-dependencies] +divan = { workspace = true } +tempfile = { workspace = true } +uucore = { workspace = true, features = ["benchmark"] } [target.'cfg(unix)'.dependencies] libc = { workspace = true } @@ -33,11 +38,6 @@ name = "rm" path = "src/main.rs" required-features = ["uucore/default"] -[target.'cfg(any(unix, windows, target_os = "wasi"))'.dev-dependencies] -divan = { workspace = true } -tempfile = { workspace = true } -uucore = { workspace = true, features = ["benchmark"] } - [lints] workspace = true