Merge branch 'trunk' of github.com:rtfeldman/roc into dict

This commit is contained in:
Chadtech 2021-02-04 00:37:30 -05:00
commit a575ff22fa
20 changed files with 221 additions and 15211 deletions

View file

@ -87,7 +87,10 @@ pub const RocStr = extern struct {
pub fn deinit(self: RocStr, allocator: *Allocator) void {
if (!self.isSmallStr() and !self.isEmpty()) {
const str_bytes_ptr: [*]u8 = self.str_bytes orelse unreachable;
const str_bytes: []u8 = str_bytes_ptr[0..self.str_len];
// include the refcount bytes
const refcount_bytes = @sizeOf(usize);
const str_bytes: []u8 = (str_bytes_ptr - refcount_bytes)[0 .. self.str_len + refcount_bytes];
allocator.free(str_bytes);
}
}