refactor(tvix/eval): consume self in Evaluation::evaluate

This simplifies lifetime management for observers in callers of tvix_eval.

Change-Id: I2f47c8d89f22b1c766526e5d1483c0d026b500ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7546
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-12-09 13:16:01 +03:00 committed by tazjin
parent 59e695a9d9
commit 6d3d237923
2 changed files with 8 additions and 9 deletions

View file

@ -20,10 +20,10 @@ struct Args {
/// and the result itself. The return value indicates whether
/// evaluation succeeded.
fn interpret(code: &str, path: Option<PathBuf>) -> bool {
let mut eval = tvix_eval::Evaluation::new(code, path);
let eval = tvix_eval::Evaluation::new(code, path);
let source_map = eval.source_map();
let result = eval.evaluate();
let source_map = eval.source_map();
for error in &result.errors {
error.fancy_format_stderr(&source_map);
}