about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/Cargo.lock2
-rw-r--r--tvix/Cargo.nix4
-rw-r--r--tvix/cli/src/derivation.rs8
-rw-r--r--tvix/cli/src/refscan.rs26
-rw-r--r--tvix/crate-hashes.json2
-rw-r--r--tvix/default.nix2
6 files changed, 15 insertions, 29 deletions
diff --git a/tvix/Cargo.lock b/tvix/Cargo.lock
index cb65d4343fcb..b221179403fa 100644
--- a/tvix/Cargo.lock
+++ b/tvix/Cargo.lock
@@ -3185,7 +3185,7 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
 [[package]]
 name = "wu-manber"
 version = "0.1.0"
-source = "git+https://github.com/tvlfyi/wu-manber.git#e77628cafcf45d41b9e455be86a6b1b9f46b2092"
+source = "git+https://github.com/tvlfyi/wu-manber.git#0d5b22bea136659f7de60b102a7030e0daaa503d"
 
 [[package]]
 name = "xml-rs"
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index b44e10de920e..9c81aa7b2070 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -10252,8 +10252,8 @@ rec {
         workspace_member = null;
         src = pkgs.fetchgit {
           url = "https://github.com/tvlfyi/wu-manber.git";
-          rev = "e77628cafcf45d41b9e455be86a6b1b9f46b2092";
-          sha256 = "02byhfiw41mlgr1c43n2iq6jw5sbyn8l1acv5v71a07h5l18q0cy";
+          rev = "0d5b22bea136659f7de60b102a7030e0daaa503d";
+          sha256 = "1zhk83lbq99xzyjwphv2qrb8f8qgfqwa5bbbvyzm0z0bljsjv0pd";
         };
         authors = [
           "Joe Neeman <joeneeman@gmail.com>"
diff --git a/tvix/cli/src/derivation.rs b/tvix/cli/src/derivation.rs
index f8afe1946110..6cde7a366c2b 100644
--- a/tvix/cli/src/derivation.rs
+++ b/tvix/cli/src/derivation.rs
@@ -311,9 +311,9 @@ mod derivation_builtins {
                 Default::default()
             } else {
                 let mut refscan = state.reference_scanner();
-                drv.arguments.iter().for_each(|s| refscan.scan_str(s));
-                drv.environment.values().for_each(|s| refscan.scan_bytes(s));
-                refscan.scan_str(&drv.builder);
+                drv.arguments.iter().for_each(|s| refscan.scan(s));
+                drv.environment.values().for_each(|s| refscan.scan(s));
+                refscan.scan(&drv.builder);
                 refscan.finalise()
             }
         };
@@ -400,7 +400,7 @@ mod derivation_builtins {
             .context("evaluating the `content` parameter of builtins.toFile")?;
 
         let mut refscan = state.borrow().reference_scanner();
-        refscan.scan_str(content.as_str());
+        refscan.scan(content.as_str());
         let refs = {
             let paths = state.borrow();
             refscan
diff --git a/tvix/cli/src/refscan.rs b/tvix/cli/src/refscan.rs
index 25ada4c86560..8d66d9e4e55b 100644
--- a/tvix/cli/src/refscan.rs
+++ b/tvix/cli/src/refscan.rs
@@ -37,29 +37,15 @@ impl<P: Clone + Ord + AsRef<[u8]>> ReferenceScanner<P> {
         }
     }
 
-    /// If the given &[u8] is also a valid UTF-8 string, scan for all non-
-    /// overlapping matches and collect them in the scanner.
-    /// TODO: ideally, wu-manber would just work with &[u8] directly.
-    pub fn scan_bytes(&mut self, haystack: &[u8]) {
-        if haystack.len() < STORE_PATH_LEN {
-            return;
-        }
-
-        match std::str::from_utf8(haystack) {
-            Ok(s) => self.scan_str(s),
-            Err(_) => {}
-        }
-    }
-
     /// Scan the given str for all non-overlapping matches and collect them
     /// in the scanner.
-    pub fn scan_str(&mut self, haystack: &str) {
-        if haystack.len() < STORE_PATH_LEN {
+    pub fn scan<S: AsRef<[u8]>>(&mut self, haystack: S) {
+        if haystack.as_ref().len() < STORE_PATH_LEN {
             return;
         }
 
         if let Some(searcher) = &self.searcher {
-            for m in searcher.find(&haystack) {
+            for m in searcher.find(haystack) {
                 self.matches.push(m.pat_idx);
             }
         }
@@ -85,7 +71,7 @@ mod tests {
     fn test_no_patterns() {
         let mut scanner: ReferenceScanner<String> = ReferenceScanner::new(vec![]);
 
-        scanner.scan_str(HELLO_DRV);
+        scanner.scan(HELLO_DRV);
 
         let result = scanner.finalise();
 
@@ -97,7 +83,7 @@ mod tests {
         let mut scanner = ReferenceScanner::new(vec![
             "/nix/store/4xw8n979xpivdc46a9ndcvyhwgif00hz-bash-5.1-p16".to_string(),
         ]);
-        scanner.scan_str(HELLO_DRV);
+        scanner.scan(HELLO_DRV);
 
         let result = scanner.finalise();
 
@@ -117,7 +103,7 @@ mod tests {
         ];
 
         let mut scanner = ReferenceScanner::new(candidates.clone());
-        scanner.scan_str(HELLO_DRV);
+        scanner.scan(HELLO_DRV);
 
         let result = scanner.finalise();
         assert_eq!(result.len(), 3);
diff --git a/tvix/crate-hashes.json b/tvix/crate-hashes.json
index 80c1718ca1c1..3e5b692e0b4b 100644
--- a/tvix/crate-hashes.json
+++ b/tvix/crate-hashes.json
@@ -1,5 +1,5 @@
 {
   "test-generator 0.3.0 (git+https://github.com/JamesGuthrie/test-generator.git?rev=82e799979980962aec1aa324ec6e0e4cad781f41#82e799979980962aec1aa324ec6e0e4cad781f41)": "08brp3qqa55hijc7xby3lam2cc84hvx1zzfqv6lj7smlczh8k32y",
   "tonic-mock 0.1.0 (git+https://github.com/brainrake/tonic-mock?branch=bump-dependencies#ec1a15510875de99d709d684190db5d9beab175e)": "0lwa03hpp0mxa6aa1zv5w68k61y4hccfm0q2ykyq392fwal8vb50",
-  "wu-manber 0.1.0 (git+https://github.com/tvlfyi/wu-manber.git#e77628cafcf45d41b9e455be86a6b1b9f46b2092)": "02byhfiw41mlgr1c43n2iq6jw5sbyn8l1acv5v71a07h5l18q0cy"
+  "wu-manber 0.1.0 (git+https://github.com/tvlfyi/wu-manber.git#0d5b22bea136659f7de60b102a7030e0daaa503d)": "1zhk83lbq99xzyjwphv2qrb8f8qgfqwa5bbbvyzm0z0bljsjv0pd"
 }
\ No newline at end of file
diff --git a/tvix/default.nix b/tvix/default.nix
index c6ac87528765..5206448451fa 100644
--- a/tvix/default.nix
+++ b/tvix/default.nix
@@ -11,7 +11,7 @@ let
     outputHashes = {
       "test-generator-0.3.0" = "08brp3qqa55hijc7xby3lam2cc84hvx1zzfqv6lj7smlczh8k32y";
       "tonic-mock-0.1.0" = "0lwa03hpp0mxa6aa1zv5w68k61y4hccfm0q2ykyq392fwal8vb50";
-      "wu-manber-0.1.0" = "02byhfiw41mlgr1c43n2iq6jw5sbyn8l1acv5v71a07h5l18q0cy";
+      "wu-manber-0.1.0" = "1zhk83lbq99xzyjwphv2qrb8f8qgfqwa5bbbvyzm0z0bljsjv0pd";
     };
   };
 in