mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-10 02:59:34 +00:00
Merge pull request #4894 from roc-lang/list-reserve-zst
handle zero-sized types in list decrement
This commit is contained in:
commit
616d699e59
3 changed files with 19 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ pub const RocList = extern struct {
|
|||
length: usize,
|
||||
capacity: usize,
|
||||
|
||||
pub fn len(self: RocList) usize {
|
||||
pub inline fn len(self: RocList) usize {
|
||||
return self.length;
|
||||
}
|
||||
|
||||
|
|
@ -410,9 +410,7 @@ pub fn listWithCapacity(
|
|||
alignment: u32,
|
||||
element_width: usize,
|
||||
) callconv(.C) RocList {
|
||||
var output = RocList.allocate(alignment, capacity, element_width);
|
||||
output.length = 0;
|
||||
return output;
|
||||
return listReserve(RocList.empty(), alignment, capacity, element_width, .InPlace);
|
||||
}
|
||||
|
||||
pub fn listReserve(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue