From 4a3325276d7c88563414610ae7c216c12e2854a0 Mon Sep 17 00:00:00 2001 From: reigadegr <103645642+reigadegr@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:58:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(ecstore):=20add=20async-recursion=20to=20re?= =?UTF-8?q?solve=20nightly=20trait=20solver=20reg=E2=80=A6=20(#415)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ecstore): add async-recursion to resolve nightly trait solver regression The newest nightly compiler switched to the new trait solver, which currently rejects async recursive functions that were previously accepted. This causes the following compilation failures: - `LocalDisk::delete_file()` - `LocalDisk::scan_dir()` Add `async-recursion` as a workspace dependency and annotate both functions with `#[async_recursion]` so that the crate compiles cleanly with the latest nightly and will continue to build once the new solver lands in stable. Signed-off-by: reigadegr <2722688642@qq.com> * fix: resolve duplicate bound error in scan_dir function Replaced inline trait bounds with where clause to avoid duplication caused by macro expansion. Signed-off-by: reigadegr <2722688642@qq.com> --------- Signed-off-by: reigadegr <2722688642@qq.com> Co-authored-by: 安正超 --- Cargo.lock | 1 + crates/ecstore/Cargo.toml | 1 + crates/ecstore/src/disk/local.rs | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 224788e12..1e169b510 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8205,6 +8205,7 @@ name = "rustfs-ecstore" version = "0.0.5" dependencies = [ "async-channel", + "async-recursion", "async-trait", "aws-sdk-s3", "base64 0.22.1", diff --git a/crates/ecstore/Cargo.toml b/crates/ecstore/Cargo.toml index 1e3d815e5..90ea21ab6 100644 --- a/crates/ecstore/Cargo.toml +++ b/crates/ecstore/Cargo.toml @@ -100,6 +100,7 @@ rustfs-rio.workspace = true rustfs-signer.workspace = true rustfs-checksums.workspace = true futures-util.workspace = true +async-recursion.workspace = true [target.'cfg(not(windows))'.dependencies] nix = { workspace = true } diff --git a/crates/ecstore/src/disk/local.rs b/crates/ecstore/src/disk/local.rs index 8da377967..c363988cd 100644 --- a/crates/ecstore/src/disk/local.rs +++ b/crates/ecstore/src/disk/local.rs @@ -440,6 +440,7 @@ impl LocalDisk { } #[tracing::instrument(level = "debug", skip(self))] + #[async_recursion::async_recursion] pub async fn delete_file( &self, base_path: &PathBuf, @@ -803,13 +804,17 @@ impl LocalDisk { Ok(()) } - async fn scan_dir( + #[async_recursion::async_recursion] + async fn scan_dir( &self, current: &mut String, opts: &WalkDirOptions, out: &mut MetacacheWriter, objs_returned: &mut i32, - ) -> Result<()> { + ) -> Result<()> + where + W: AsyncWrite + Unpin + Send, + { let forward = { opts.forward_to.as_ref().filter(|v| v.starts_with(&*current)).map(|v| { let forward = v.trim_start_matches(&*current);