about summary refs log tree commit diff
path: root/tvix/eval/src/nix_search_path.rs
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-02-10T17·22-0500
committerclbot <clbot@tvl.fyi>2024-02-10T20·35+0000
commit5d72d3980f21ac720520e4d2450f0709b6b581ea (patch)
tree6cc1106b84c2b10db10e2fdde9c36f636832e777 /tvix/eval/src/nix_search_path.rs
parent5d2ae840f13641a6f699ab77d43e41d98f459053 (diff)
refactor(tvix/eval): Box the strings in CatchableErrorKind r/7497
These strings are allocated once and never changed, so they don't need
the additional overhead of a capacity given by String - instead, we can
use Box<str> and save on 16 bytes for each of these, *and* for each
Value since this is currently the largest Value variant.

Change-Id: I3e5cb070fe6c5bf82114c92d04f6bae775663a7e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10796
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/nix_search_path.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/tvix/eval/src/nix_search_path.rs b/tvix/eval/src/nix_search_path.rs
index 2f6d444475..566ca12238 100644
--- a/tvix/eval/src/nix_search_path.rs
+++ b/tvix/eval/src/nix_search_path.rs
@@ -138,10 +138,13 @@ impl NixSearchPath {
                 return Ok(Ok(p));
             }
         }
-        Ok(Err(CatchableErrorKind::NixPathResolution(format!(
-            "path '{}' was not found in the Nix search path",
-            path.display()
-        ))))
+        Ok(Err(CatchableErrorKind::NixPathResolution(
+            format!(
+                "path '{}' was not found in the Nix search path",
+                path.display()
+            )
+            .into_boxed_str(),
+        )))
     }
 }