about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-12T14·21+0300
committertazjin <tazjin@tvl.su>2022-08-27T09·27+0000
commit4c9d3fa2a6cd19ce0041d56e43c6f7ca958171e4 (patch)
tree24cf9767bf3951c4e44661044376c9d8614edfd6
parent4523703a980f685440b51c9fcaaf299df85711fa (diff)
chore(tvix/eval): explicitly set #[repr(transparent)] on wrappers r/4512
For representation wrappers that are used to control the visibility of
type internals, this ensures that the wrapper does not increase the
size of the type.

In practice, the optimiser likely does this anyways but it is good to
guarantee it.

Change-Id: Ic6df7d668fe6006dfbd5b6cfcfc2088afa95b810
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6178
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
-rw-r--r--tvix/eval/src/value/attrs.rs1
-rw-r--r--tvix/eval/src/value/list.rs1
-rw-r--r--tvix/eval/src/value/string.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 0ab4538a4d..2efeaad413 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -67,6 +67,7 @@ impl AttrsRep {
     }
 }
 
+#[repr(transparent)]
 #[derive(Clone, Debug)]
 pub struct NixAttrs(AttrsRep);
 
diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs
index 546d2c88a5..fab85a73ec 100644
--- a/tvix/eval/src/value/list.rs
+++ b/tvix/eval/src/value/list.rs
@@ -3,6 +3,7 @@ use std::fmt::Display;
 
 use super::Value;
 
+#[repr(transparent)]
 #[derive(Clone, Debug, PartialEq)]
 pub struct NixList(Vec<Value>);
 
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs
index 626cf398f2..122a82e048 100644
--- a/tvix/eval/src/value/string.rs
+++ b/tvix/eval/src/value/string.rs
@@ -11,6 +11,7 @@ enum StringRepr {
     Heap(String),
 }
 
+#[repr(transparent)]
 #[derive(Clone, Debug)]
 pub struct NixString(StringRepr);