chore(tvix/eval): gate tvix_eval::StdIO behind the impure feature

This shouldn't be available if we've built a "pure" crate.

Change-Id: I7c85827ee212890252ff7e0b6242e2c52618cba5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7572
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-12-12 19:10:55 +03:00 committed by tazjin
parent 29790147b6
commit ec3e38c2d6
2 changed files with 6 additions and 1 deletions

View file

@ -27,8 +27,10 @@ pub trait EvalIO {
/// Implementation of [`EvalIO`] that simply uses the equivalent /// Implementation of [`EvalIO`] that simply uses the equivalent
/// standard library functions, i.e. does local file-IO. /// standard library functions, i.e. does local file-IO.
#[cfg(feature = "impure")]
pub struct StdIO; pub struct StdIO;
#[cfg(feature = "impure")]
impl EvalIO for StdIO { impl EvalIO for StdIO {
fn read_to_string(&self, path: PathBuf) -> Result<String, ErrorKind> { fn read_to_string(&self, path: PathBuf) -> Result<String, ErrorKind> {
let path: PathBuf = path.into(); let path: PathBuf = path.into();

View file

@ -45,7 +45,7 @@ use std::sync::Arc;
pub use crate::builtins::global_builtins; pub use crate::builtins::global_builtins;
pub use crate::compiler::{compile, prepare_globals}; pub use crate::compiler::{compile, prepare_globals};
pub use crate::errors::{Error, ErrorKind, EvalResult}; pub use crate::errors::{Error, ErrorKind, EvalResult};
pub use crate::io::{DummyIO, EvalIO, StdIO}; pub use crate::io::{DummyIO, EvalIO};
use crate::observer::{CompilerObserver, RuntimeObserver}; use crate::observer::{CompilerObserver, RuntimeObserver};
pub use crate::pretty_ast::pretty_print_expr; pub use crate::pretty_ast::pretty_print_expr;
pub use crate::source::SourceCode; pub use crate::source::SourceCode;
@ -53,6 +53,9 @@ pub use crate::value::Value;
pub use crate::vm::run_lambda; pub use crate::vm::run_lambda;
pub use crate::warnings::{EvalWarning, WarningKind}; 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 /// Internal-only parts of `tvix-eval`, exported for use in macros, but not part of the public
/// interface of the crate. /// interface of the crate.
pub mod internal { pub mod internal {