diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-31T01·27+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-07T15·25+0000 |
commit | 7d5dca7ba38be487d04b6ba78e1d70530f635fee (patch) | |
tree | 6b7326db01c59021f495541492c53353b5d0e790 /tvix/eval/src | |
parent | 80713f207e2cd5c490a14a9b00e014c4677b2197 (diff) |
chore(tvix/eval): provide 'static references to "name"/"value" r/4701
These static strings show up a bunch when dealing with the internals of attribute sets, and having them available as static references is required. Due to the way const expressions are evaluated, taking a reference to the existing NixString::NAME / NixString::VALUE items does not work and the references themselves need to be const-evaluated. Change-Id: If6e75847af978118a3b266fe6a3242321722434d Reviewed-on: https://cl.tvl.fyi/c/depot/+/6366 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/value/string.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index 65022b6cc49c..095f87645cc5 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -60,7 +60,10 @@ impl Hash for NixString { impl NixString { pub const NAME: Self = NixString(StringRepr::Smol(SmolStr::new_inline("name"))); + pub const NAME_REF: &'static Self = &Self::NAME; + pub const VALUE: Self = NixString(StringRepr::Smol(SmolStr::new_inline("value"))); + pub const VALUE_REF: &'static Self = &Self::VALUE; pub fn as_str(&self) -> &str { match &self.0 { |