Remove all box references

This commit is contained in:
Ayaz Hafiz 2023-07-12 15:50:00 -05:00
parent b5db3f68e1
commit a8d821bf87
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
9 changed files with 39 additions and 148 deletions

View file

@ -1,5 +1,7 @@
use roc_target::TargetInfo;
use super::{InLayout, LayoutRepr};
/// The layout of an erasure.
///
/// A type-erased value consists of three fields at runtime:
@ -53,3 +55,12 @@ impl Erased {
alloc.text("?Erased")
}
}
impl<'a> LayoutRepr<'a> {
pub fn boxed_erased_value(value: &'a InLayout<'a>) -> Self {
Self::Union(super::UnionLayout::NullableUnwrapped {
nullable_id: true,
other_fields: std::slice::from_ref(value),
})
}
}