diff --git a/compiler/gen_llvm/src/llvm/refcounting.rs b/compiler/gen_llvm/src/llvm/refcounting.rs index 0098432aa5..e42414279d 100644 --- a/compiler/gen_llvm/src/llvm/refcounting.rs +++ b/compiler/gen_llvm/src/llvm/refcounting.rs @@ -20,6 +20,7 @@ use roc_module::symbol::Symbol; use roc_mono::layout::{Builtin, Layout, LayoutIds, UnionLayout}; use roc_target::TargetInfo; +use super::build::load_roc_value; use super::convert::{argument_type_from_layout, argument_type_from_union_layout}; /// "Infinite" reference count, for static values @@ -1434,9 +1435,8 @@ fn build_rec_union_recursive_decrement<'a, 'ctx, 'env>( .build_struct_gep(struct_ptr, i as u32, "gep_recursive_pointer") .unwrap(); - let field = env - .builder - .build_load(elem_pointer, "decrement_struct_field"); + let field = + load_roc_value(env, *field_layout, elem_pointer, "decrement_struct_field"); deferred_nonrec.push((field, field_layout)); }