diff options
author | Vincent Ambo <mail@tazj.in> | 2023-01-20T13·18+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-01-20T22·48+0000 |
commit | 7442558b33b3f1ebcf356924b0345cb73d0524ab (patch) | |
tree | f66d9c9bbaac9ba9c48d4307794a178b5ee13d49 /tvix/eval/src/value/mod.rs | |
parent | 6d03e310603869b7ad67bd00f8eb858e362bd763 (diff) |
refactor(tvix/eval): keep globals alive through VM struct r/5715
This forces users to pass the fully constructed set of globals to the VM, making it harder to accidentally "lose" the set while weak references to it still exist. This doesn't modify any functionality, but is laying the foundation for simplifying some of the builtins behaviour that has grown more complex again. Change-Id: I5120f97861c65dc46d90b8a4e2c92ad32cc53e03 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7877 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r-- | tvix/eval/src/value/mod.rs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 9ab23043c523..7a6bbcafb30f 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -578,7 +578,12 @@ mod tests { #[proptest(ProptestConfig { cases: 5, ..Default::default() })] fn reflexive(x: Value) { let mut observer = NoOpObserver {}; - let mut vm = VM::new(Default::default(), Box::new(crate::DummyIO), &mut observer); + let mut vm = VM::new( + Default::default(), + Box::new(crate::DummyIO), + &mut observer, + Default::default(), + ); assert!(x.nix_eq(&x, &mut vm).unwrap()) } @@ -586,7 +591,12 @@ mod tests { #[proptest(ProptestConfig { cases: 5, ..Default::default() })] fn symmetric(x: Value, y: Value) { let mut observer = NoOpObserver {}; - let mut vm = VM::new(Default::default(), Box::new(crate::DummyIO), &mut observer); + let mut vm = VM::new( + Default::default(), + Box::new(crate::DummyIO), + &mut observer, + Default::default(), + ); assert_eq!( x.nix_eq(&y, &mut vm).unwrap(), @@ -597,7 +607,12 @@ mod tests { #[proptest(ProptestConfig { cases: 5, ..Default::default() })] fn transitive(x: Value, y: Value, z: Value) { let mut observer = NoOpObserver {}; - let mut vm = VM::new(Default::default(), Box::new(crate::DummyIO), &mut observer); + let mut vm = VM::new( + Default::default(), + Box::new(crate::DummyIO), + &mut observer, + Default::default(), + ); if x.nix_eq(&y, &mut vm).unwrap() && y.nix_eq(&z, &mut vm).unwrap() { assert!(x.nix_eq(&z, &mut vm).unwrap()) @@ -607,7 +622,12 @@ mod tests { #[test] fn list_int_float_fungibility() { let mut observer = NoOpObserver {}; - let mut vm = VM::new(Default::default(), Box::new(crate::DummyIO), &mut observer); + let mut vm = VM::new( + Default::default(), + Box::new(crate::DummyIO), + &mut observer, + Default::default(), + ); let v1 = Value::List(NixList::from(vector![Value::Integer(1)])); let v2 = Value::List(NixList::from(vector![Value::Float(1.0)])); |