From f4e17caae88a1180444d8120ba35565e9853199d Mon Sep 17 00:00:00 2001 From: Lyle Mantooth Date: Sat, 3 Dec 2022 00:18:58 -0500 Subject: feat(tvix/eval): Continue removing leakage of BTreeMap. Fixes b/212. Based on feedback in https://cl.tvl.fyi/c/depot/+/7492, all uses of `NixAttrs::from_map` have been removed. Only `from_iter` and `from_kv` remain. Change-Id: I52e25f73018c2aa1843197427516b7a852503e2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7500 Reviewed-by: tazjin Tested-by: BuildkiteCI Autosubmit: IslandUsurper --- tvix/eval/src/value/attrs.rs | 8 -------- tvix/eval/src/value/mod.rs | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs index 0ef28f068cf2..ecce34fb4af4 100644 --- a/tvix/eval/src/value/attrs.rs +++ b/tvix/eval/src/value/attrs.rs @@ -345,14 +345,6 @@ impl NixAttrs { Ok(attrs) } - /// Construct an attribute set directly from a BTreeMap - /// representation. This is only visible inside of the crate, as - /// it is intended exclusively for use with the construction of - /// global sets for the compiler. - pub(crate) fn from_map(map: BTreeMap) -> Self { - NixAttrs(AttrsRep::Map(map)) - } - /// Construct an optimized "KV"-style attribute set given the value for the /// `"name"` key, and the value for the `"value"` key pub(crate) fn from_kv(name: Value, value: Value) -> Self { diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index f0e3b84b9251..2bca9e6d3202 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -526,10 +526,11 @@ impl TryFrom for Value { name.clone().try_into()?, value.clone().try_into()?, ))), - _ => Ok(Self::attrs(NixAttrs::from_map( + _ => Ok(Self::attrs(NixAttrs::from_iter( obj.into_iter() .map(|(k, v)| Ok((k.into(), v.try_into()?))) - .collect::>()?, + .collect::, ErrorKind>>()? + .into_iter(), ))), } } -- cgit 1.4.1