about summary refs log tree commit diff
path: root/tvix/derivation
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-23T13·17+0300
committertazjin <tazjin@tvl.su>2023-01-23T15·08+0000
commit9f75973e4a93b0625f100e9d01f049dac4ac79e4 (patch)
treea6e1dea6eda4750c4b9b9ac7d9faa77ef0a30d22 /tvix/derivation
parentb0d6e748acbdfb914bfe53c1c91345a408cc8726 (diff)
refactor(tvix/derivation): relax bounds for reference iterator r/5740
This makes it easier to pass owned strings if that's what we have.

Change-Id: Ia7351ff2681292d16534ec50fe60b926b683bb9a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7908
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation')
-rw-r--r--tvix/derivation/src/derivation.rs4
-rw-r--r--tvix/derivation/src/tests/mod.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs
index f2d88e301fff..45fcfb6b9f4b 100644
--- a/tvix/derivation/src/derivation.rs
+++ b/tvix/derivation/src/derivation.rs
@@ -75,7 +75,7 @@ fn build_store_path(
 
 /// Build a store path for a literal text file in the store that may
 /// contain references.
-pub fn path_with_references<'a, I: IntoIterator<Item = &'a str>, C: AsRef<[u8]>>(
+pub fn path_with_references<S: AsRef<str>, I: IntoIterator<Item = S>, C: AsRef<[u8]>>(
     name: &str,
     content: C,
     references: I,
@@ -84,7 +84,7 @@ pub fn path_with_references<'a, I: IntoIterator<Item = &'a str>, C: AsRef<[u8]>>
 
     for reference in references {
         s.push(':');
-        s.push_str(reference);
+        s.push_str(reference.as_ref());
     }
 
     let content_digest = {
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs
index ce39afdd2854..644e0685d735 100644
--- a/tvix/derivation/src/tests/mod.rs
+++ b/tvix/derivation/src/tests/mod.rs
@@ -313,7 +313,7 @@ fn path_with_zero_references() {
     // nix-repl> builtins.toFile "foo" "bar"
     // "/nix/store/vxjiwkjkn7x4079qvh1jkl5pn05j2aw0-foo"
 
-    let store_path = crate::path_with_references("foo", "bar", vec![])
+    let store_path = crate::path_with_references("foo", "bar", Vec::<String>::new())
         .expect("path_with_references() should succeed");
 
     assert_eq!(
@@ -329,7 +329,7 @@ fn path_with_non_zero_references() {
     // nix-repl> builtins.toFile "baz" "${builtins.toFile "foo" "bar"}"
     // "/nix/store/5xd714cbfnkz02h2vbsj4fm03x3f15nf-baz"
 
-    let inner = crate::path_with_references("foo", "bar", vec![])
+    let inner = crate::path_with_references("foo", "bar", Vec::<String>::new())
         .expect("path_with_references() should succeed");
     let inner_path = inner.to_absolute_path();