From 88432235ae34d853f57842a862d7c7ea40793f2d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 4 Jan 2023 02:21:34 +0300 Subject: fix(tvix/eval): VM & Builtin* types have to be public ... without them, using the new Builtins API is basically impossible for library consumers. Change-Id: Ice0557a2e55e12d812f51bf5a99e6b8c91ad1b91 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7755 Autosubmit: tazjin Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/eval/builtin-macros/src/lib.rs | 8 ++++---- tvix/eval/src/lib.rs | 11 ++--------- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'tvix') diff --git a/tvix/eval/builtin-macros/src/lib.rs b/tvix/eval/builtin-macros/src/lib.rs index ac994954ba60..ff1c52e03fd8 100644 --- a/tvix/eval/builtin-macros/src/lib.rs +++ b/tvix/eval/builtin-macros/src/lib.rs @@ -167,7 +167,7 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream { }; Ok(quote_spanned!(arg.span() => { - crate::internal::BuiltinArgument { + crate::BuiltinArgument { strict: #strict, name: #name, } @@ -194,11 +194,11 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream { }; builtins.push(quote_spanned! { builtin_attr.span() => { - crate::internal::Builtin::new( + crate::Builtin::new( #name, &[#(#builtin_arguments),*], #docstring, - |mut args: Vec, vm: &mut crate::internal::VM| { + |mut args: Vec, vm: &mut crate::VM| { #(let #reversed_args = args.pop().unwrap();)* #fn_name(vm, #(#args),*) } @@ -209,7 +209,7 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream { } items.push(parse_quote! { - pub fn builtins() -> Vec { + pub fn builtins() -> Vec { vec![#(#builtins),*] } }); diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs index e2a7283f443a..8980814fc163 100644 --- a/tvix/eval/src/lib.rs +++ b/tvix/eval/src/lib.rs @@ -47,20 +47,13 @@ pub use crate::io::{DummyIO, EvalIO, FileType}; use crate::observer::{CompilerObserver, RuntimeObserver}; pub use crate::pretty_ast::pretty_print_expr; pub use crate::source::SourceCode; -pub use crate::value::{NixAttrs, NixList, NixString, Value}; -pub use crate::vm::run_lambda; +pub use crate::value::{Builtin, BuiltinArgument, NixAttrs, NixList, NixString, Value}; +pub use crate::vm::{run_lambda, VM}; pub use crate::warnings::{EvalWarning, WarningKind}; #[cfg(feature = "impure")] pub use crate::io::StdIO; -/// 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, BuiltinArgument}; - pub use crate::vm::VM; -} - /// An `Evaluation` represents how a piece of Nix code is evaluated. It can be /// instantiated and configured directly, or it can be accessed through the /// various simplified helper methods available below. -- cgit 1.4.1