mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Correct refcounting check to be recursive through aggregate types
This commit is contained in:
parent
951cb1ef3d
commit
9b6798ead1
2 changed files with 3 additions and 1 deletions
|
@ -104,7 +104,7 @@ pub(crate) fn layout_refcounted<'a, 'ctx>(
|
||||||
) -> BasicValueEnum<'ctx> {
|
) -> BasicValueEnum<'ctx> {
|
||||||
let is_refcounted = layout_interner
|
let is_refcounted = layout_interner
|
||||||
.get_repr(layout)
|
.get_repr(layout)
|
||||||
.is_refcounted(layout_interner);
|
.contains_refcounted(layout_interner);
|
||||||
env.context
|
env.context
|
||||||
.bool_type()
|
.bool_type()
|
||||||
.const_int(is_refcounted as u64, false)
|
.const_int(is_refcounted as u64, false)
|
||||||
|
|
|
@ -556,6 +556,8 @@ impl Hash for U128 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All Roc types that are refcounted must implement this trait.
|
/// All Roc types that are refcounted must implement this trait.
|
||||||
|
///
|
||||||
|
/// For aggregate types, this must recurse down the structure.
|
||||||
pub trait RocRefcounted {
|
pub trait RocRefcounted {
|
||||||
/// Increments the refcount n times.
|
/// Increments the refcount n times.
|
||||||
fn inc(&mut self, n: usize);
|
fn inc(&mut self, n: usize);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue