fix(vm): lifetime (still does not compile)
This commit is contained in:
@@ -55,14 +55,12 @@ pub fn run(mut prog: Program) -> Result<p::Value> {
|
||||
let arena: Arena<Rootable![GcRoot<'_>]> = Arena::new(|mc| {
|
||||
new(&mut prog, mc)
|
||||
});
|
||||
eval(prog.top_level.into_iter(), &arena, |val| {
|
||||
Ok(arena.mutate(|_, root: &GcRoot| {
|
||||
val.to_public(&root.vm, &mut HashSet::new())
|
||||
}))
|
||||
eval(prog.top_level.into_iter(), &arena, |val, vm| {
|
||||
Ok(val.to_public(vm, &mut HashSet::new()))
|
||||
})
|
||||
}
|
||||
|
||||
fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>) -> Result<T>>(
|
||||
fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>, &VM<'a>) -> Result<T>>(
|
||||
opcodes: impl Iterator<Item = OpCode>,
|
||||
arena: &Arena<impl for<'a> Rootable<'a, Root = GcRoot<'a>>>,
|
||||
f: F
|
||||
@@ -87,7 +85,7 @@ fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>) -> Result<T>>(
|
||||
assert_eq!(ctx.stack.len(), 1);
|
||||
let mut ret = ctx.stack.pop();
|
||||
ret.force(&root.vm, mc);
|
||||
f(ret)
|
||||
f(ret, &root.vm)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user