fix(ecstore): add async-recursion to resolve nightly trait solver reg… (#415)

* 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: 安正超 <anzhengchao@gmail.com>
This commit is contained in:
reigadegr
2025-08-18 20:58:05 +08:00
committed by GitHub
parent c5f6c66f72
commit 4a3325276d
3 changed files with 9 additions and 2 deletions
Generated
+1
View File
@@ -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",
+1
View File
@@ -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 }
+7 -2
View File
@@ -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<W: AsyncWrite + Unpin>(
#[async_recursion::async_recursion]
async fn scan_dir<W>(
&self,
current: &mut String,
opts: &WalkDirOptions,
out: &mut MetacacheWriter<W>,
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);