diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index fcd4ff9761..5d794210aa 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -807,6 +807,16 @@ pub fn store_list<'a, 'ctx, 'env>( .build_insert_value(struct_val, len, Builtin::WRAPPER_LEN, "insert_len") .unwrap(); + // Store the capacity + struct_val = builder + .build_insert_value( + struct_val, + len, + Builtin::WRAPPER_CAPACITY, + "insert_capacity", + ) + .unwrap(); + builder.build_bitcast( struct_val.into_struct_value(), super::convert::zig_list_type(env),