about summary refs log tree commit diff
path: root/tvix/store/src/nar/import.rs
diff options
context:
space:
mode:
authorConnor Brewster <cbrewster@hey.com>2024-05-06T15·53-0500
committerclbot <clbot@tvl.fyi>2024-05-06T16·05+0000
commitda9bc274f3a07a461b279b18c6b650b0a2808c39 (patch)
treeec027f4e2b643ff0a95014b57f29327826291092 /tvix/store/src/nar/import.rs
parent01a4a2399c2455b672051c1a005dabaf2971025d (diff)
refactor(tvix): remove usage of async-recursion r/8082
Rust 1.77 supports async recursion as long as there is some form of
indirection (ie. `Box::pin`). This removes the need to use the
async-recursion crate.

Change-Id: Ic9613ab7f32016f0103032a861edff92e2fb8b41
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11596
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/nar/import.rs')
-rw-r--r--tvix/store/src/nar/import.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/tvix/store/src/nar/import.rs b/tvix/store/src/nar/import.rs
index bfb65629e6..cc62c1a4e9 100644
--- a/tvix/store/src/nar/import.rs
+++ b/tvix/store/src/nar/import.rs
@@ -1,4 +1,3 @@
-use async_recursion::async_recursion;
 use nix_compat::nar::reader::r#async as nar_reader;
 use tokio::{io::AsyncBufRead, sync::mpsc, try_join};
 use tvix_castore::{
@@ -54,10 +53,9 @@ where
     Ok(node.rename("".into()))
 }
 
-#[async_recursion]
-async fn produce_nar_inner<'a: 'async_recursion, 'r: 'async_recursion, BS>(
+async fn produce_nar_inner<BS>(
     blob_service: BS,
-    node: nar_reader::Node<'a, 'r>,
+    node: nar_reader::Node<'_, '_>,
     path: PathBuf,
     tx: mpsc::Sender<Result<IngestionEntry, Error>>,
 ) -> Result<IngestionEntry, Error>
@@ -93,8 +91,13 @@ where
                 path.try_push(&entry.name)
                     .expect("Tvix bug: failed to join name");
 
-                let entry =
-                    produce_nar_inner(blob_service.clone(), entry.node, path, tx.clone()).await?;
+                let entry = Box::pin(produce_nar_inner(
+                    blob_service.clone(),
+                    entry.node,
+                    path,
+                    tx.clone(),
+                ))
+                .await?;
 
                 tx.send(Ok(entry)).await.map_err(|e| {
                     Error::IO(std::io::Error::new(std::io::ErrorKind::BrokenPipe, e))