Skip to content

Commit a0d5346

Browse files
authored
Lift/lower refactors inspired by map<K, V> (#12753)
In reading over #12216 I found a few related but also somewhat orthogonal refactors that I wanted to implement, and thus this commit. Changes here are: * Handling pointer pairs for lists/maps/strings is now more uniform with a single set of functions doing the lift/lower to flat/memory. Less "FIXME 4311" spread throughout effectively. * Conditional defines and organization of the `HashMap`-related impls were tweaked, for example impls on `HashMap` are now unconditional as well as `TryHashMap`. Some internals were refactored to in theory reduce complexity, but this is also subjective. * Lifting a `map<K, V>` now consumes fuel, a recent change, to ensure that resource exhaustion in the host is limited.
1 parent a8fc10c commit a0d5346

3 files changed

Lines changed: 168 additions & 321 deletions

File tree

crates/environ/src/collections/hash_map.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,9 @@ impl<K, V, S> IntoIterator for TryHashMap<K, V, S> {
252252
self.inner.into_iter()
253253
}
254254
}
255+
256+
impl<K, V, S> From<TryHashMap<K, V, S>> for inner::HashMap<K, V, S> {
257+
fn from(map: TryHashMap<K, V, S>) -> Self {
258+
map.inner
259+
}
260+
}

0 commit comments

Comments
 (0)