feat(tvix/eval): remove derive(Copy) from Upvalues
Change-Id: I0fa069fbeff6718a765ece948c2c1bce285496f7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7449 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
e04b1697e4
commit
922bf7aca9
3 changed files with 26 additions and 12 deletions
|
|
@ -39,7 +39,14 @@ impl Formals {
|
|||
/// OpThunkSuspended referencing it. At runtime `Lambda` is usually wrapped
|
||||
/// in `Rc` to avoid copying the `Chunk` it holds (which can be
|
||||
/// quite large).
|
||||
#[derive(Debug, Default)]
|
||||
///
|
||||
/// In order to correctly reproduce cppnix's "pointer equality"
|
||||
/// semantics it is important that we never clone a Lambda --
|
||||
/// use Rc<Lambda>::clone() instead. This struct deliberately
|
||||
/// does not `derive(Clone)` in order to prevent this from being
|
||||
/// done accidentally.
|
||||
///
|
||||
#[derive(/* do not add Clone here */ Debug, Default)]
|
||||
pub struct Lambda {
|
||||
pub(crate) chunk: Chunk,
|
||||
|
||||
|
|
@ -62,7 +69,14 @@ impl Lambda {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
///
|
||||
/// In order to correctly reproduce cppnix's "pointer equality"
|
||||
/// semantics it is important that we never clone a Lambda --
|
||||
/// use Rc<Lambda>::clone() instead. This struct deliberately
|
||||
/// does not `derive(Clone)` in order to prevent this from being
|
||||
/// done accidentally.
|
||||
///
|
||||
#[derive(/* do not add Clone here */ Debug)]
|
||||
pub struct Closure {
|
||||
pub lambda: Rc<Lambda>,
|
||||
pub upvalues: Rc<Upvalues>,
|
||||
|
|
@ -88,7 +102,7 @@ impl Closure {
|
|||
self.lambda.clone()
|
||||
}
|
||||
|
||||
pub fn upvalues(&self) -> &Upvalues {
|
||||
&self.upvalues
|
||||
pub fn upvalues(&self) -> Rc<Upvalues> {
|
||||
self.upvalues.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue