about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/eval/builtin-macros/src/lib.rs6
-rw-r--r--tvix/eval/builtin-macros/tests/tests.rs9
-rw-r--r--tvix/eval/src/lib.rs11
3 files changed, 16 insertions, 10 deletions
diff --git a/tvix/eval/builtin-macros/src/lib.rs b/tvix/eval/builtin-macros/src/lib.rs
index 18889505e6d4..8e2c4b3f8776 100644
--- a/tvix/eval/builtin-macros/src/lib.rs
+++ b/tvix/eval/builtin-macros/src/lib.rs
@@ -120,10 +120,10 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream {
                 reversed_args.reverse();
 
                 builtins.push(quote_spanned! { builtin_attr.span() => {
-                    crate::value::Builtin::new(
+                    crate::internal::Builtin::new(
                         #name,
                         &[#(#strictness),*],
-                        |mut args: Vec<Value>, vm: &mut VM| {
+                        |mut args: Vec<crate::Value>, vm: &mut crate::internal::VM| {
                             #(let #reversed_args = args.pop().unwrap();)*
                             #fn_name(vm, #(#args),*)
                         }
@@ -134,7 +134,7 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream {
     }
 
     items.push(parse_quote! {
-        pub fn builtins() -> Vec<crate::value::Builtin> {
+        pub fn builtins() -> Vec<crate::internal::Builtin> {
             vec![#(#builtins),*]
         }
     });
diff --git a/tvix/eval/builtin-macros/tests/tests.rs b/tvix/eval/builtin-macros/tests/tests.rs
index 8f3e83b672ef..d07020f69bb7 100644
--- a/tvix/eval/builtin-macros/tests/tests.rs
+++ b/tvix/eval/builtin-macros/tests/tests.rs
@@ -1,12 +1,11 @@
+pub use tvix_eval::internal;
+pub use tvix_eval::Value;
 use tvix_eval_builtin_macros::builtins;
 
-mod value {
-    pub use tvix_eval::Builtin;
-}
-
 #[builtins]
 mod builtins {
-    use tvix_eval::{ErrorKind, Value, VM};
+    use tvix_eval::internal::VM;
+    use tvix_eval::{ErrorKind, Value};
 
     #[builtin("identity")]
     pub fn builtin_identity(_vm: &mut VM, x: Value) -> Result<Value, ErrorKind> {
diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs
index 4dd324f62eae..106f7d851cd3 100644
--- a/tvix/eval/src/lib.rs
+++ b/tvix/eval/src/lib.rs
@@ -31,8 +31,15 @@ pub use crate::errors::{ErrorKind, EvalResult};
 pub use crate::eval::{interpret, Options};
 pub use crate::pretty_ast::pretty_print_expr;
 pub use crate::source::SourceCode;
-pub use crate::value::{Builtin, Value};
-pub use crate::vm::{run_lambda, VM};
+pub use crate::value::Value;
+pub use crate::vm::run_lambda;
+
+/// Internal-only parts of `tvix-eval`, exported for use in macros, but not part of the public
+/// interface of the crate.
+pub mod internal {
+    pub use crate::value::Builtin;
+    pub use crate::vm::VM;
+}
 
 // TODO: use Rc::unwrap_or_clone once it is stabilised.
 // https://doc.rust-lang.org/std/rc/struct.Rc.html#method.unwrap_or_clone