feat(tvix/eval): add Closure::ptr_eq()

See cl/7368

Change-Id: I97630994c3d65f4d16414a0da236ce000a5b6d33
Signed-off-by: Adam Joseph <adam@westernsemico.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7374
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2022-11-24 00:39:37 -08:00 committed by clbot
parent 0616976f7c
commit 6b986de92b

View file

@ -79,6 +79,12 @@ impl Closure {
)
}
/// Do not call this function unless you have read
/// `tvix/docs/value-pointer-equality.md` carefully.
pub fn ptr_eq(&self, other: &Self) -> bool {
Rc::ptr_eq(&self.lambda, &other.lambda) && Rc::ptr_eq(&self.upvalues, &other.upvalues)
}
pub fn new_with_upvalues(upvalues: Rc<Upvalues>, lambda: Rc<Lambda>) -> Self {
Closure {
upvalues,