navid/veins / commit

943fb7406a9e

Navid M <navidmomtahen@gmail.com> · 2026-11-25

parents: 8583d3056e25

Browse files at this commit · Download source

all: fixes
--- a/src/src/chunking/fastcdc.sx+++ b/src/src/chunking/fastcdc.sx@@ -52,7 +52,7 @@         if (fp & MASK_S) == 0 {             return i + 1         }-        i+++        i = i + 1     }     for i < limit {         val c2: u8 = trust @load8(@ptradd(data, i as i64))@@ -60,7 +60,7 @@         if (fp & MASK_L) == 0 {             return i + 1         }-        i+++        i = i + 1     }     return limit }--- a/src/src/cli/selftest_cmd.sx+++ b/src/src/cli/selftest_cmd.sx@@ -33,7 +33,7 @@     for i < n {         val v: u8 = ((i * 31 + seed * 17) % 251) as u8         @store8(@ptradd(p, i as i64), v)-        i+++        i = i + 1     } } @@ -43,8 +43,8 @@     val want: ref u8 = @alloc(32) as ref u8     val parsed: bool = objid.hex_decode(expected_hex, 32, want)     val same: bool = parsed && bytes.Bytes.eql(bytes.bytes(out, 32), bytes.bytes(want, 32))-    @free(out)-    @free(want)+    @free(out as ref void)+    @free(want as ref void)     return same } @@ -51,7 +51,7 @@ fn assert_id(id: objid.Id, expected_hex: ref u8) void = trust {     val hx: ref u8 = objid.Id.hex(id)     val same: bool = bytes.Bytes.eql(bytes.from_cstr(hx), bytes.from_cstr(expected_hex))-    @free(hx)+    @free(hx as ref void)     assert same } @@ -60,7 +60,7 @@     objid.hex_encode(data.ptr, data.len, hx)     @store8(@ptradd(hx, (data.len * 2) as i64), 0)     val same: bool = bytes.Bytes.eql(bytes.from_cstr(hx), bytes.from_cstr(expected_hex))-    @free(hx)+    @free(hx as ref void)     assert same } @@ -68,7 +68,7 @@     val digest: ref u8 = @alloc(32) as ref u8     b3.hash(data.ptr, data.len, digest)     assert_bytes_hex(bytes.bytes(digest, 32), expected_hex)-    @free(digest)+    @free(digest as ref void) }  fn fuzz_once(data: bytes.Bytes) void = trust {@@ -168,12 +168,12 @@             state = state ^ (state >> 7)             state = state ^ (state << 17)             @store8(@ptradd(data, j as i64), (state & 255) as u8)-            j+++            j = j + 1         }         fuzz_once(bytes.bytes(data, n))-        i+++        i = i + 1     }-    @free(data)+    @free(data as ref void) }  fn test_pack_layout() void = trust {@@ -275,7 +275,7 @@     @free(p1)     @free(p2)     @listfree(lens)-    @free(data)+    @free(data as ref void) }  fn write_one(repo: layout.Repo, kind: u8, body: bytes.Bytes) objid.Id = {@@ -322,7 +322,7 @@     val i: mut usize = 0     for i < 16 {         trust @store8(@ptradd(change, i as i64), (i + 11) as u8)-        i+++        i = i + 1     }     val sig: prim.Sig = prim.Sig{         name: bytes.bytes(c"Alice", 5),@@ -362,7 +362,7 @@     val id: objid.Id = write_one(repo, types.COMMIT, body)     val bp: mut ref void = body.ptr as ref void     trust @free(bp)-    trust @free(change)+    trust @free(change as ref void)     @listfree(parents)     @listfree(renames)     @listfree(extra)@@ -394,11 +394,11 @@     val bp: mut ref void = body.ptr as ref void     trust @free(bp)     for v in adds {-        val vp: mut u8 = v+        val vp: mut ref void = v as ref void         trust @free(vp)     }     for v in removes {-        val vp2: mut u8 = v+        val vp2: mut ref void = v as ref void         trust @free(vp2)     }     @listfree(adds)@@ -454,8 +454,8 @@     @listfree(tags)     @listfree(remotes)     @listfree(wcs)-    trust @free(bm)-    trust @free(wc)+    trust @free(bm as ref void)+    trust @free(wc as ref void)     return id } @@ -500,7 +500,7 @@     assert files.write_all(p, bytes.empty())     files.free_path(p)     files.free_path(dir)-    trust @free(hx)+    trust @free(hx as ref void) }  fn test_repository(repo: layout.Repo) void = trust {@@ -534,7 +534,7 @@         }         err e => {             stdio.eprint("selftest: cannot create repo ({d})\n", {e})-            @free(path)+            @free(path as ref void)             return 1         }     }@@ -541,7 +541,7 @@     test_repository(repo)     val status: i32 = fsck.check(repo, false)     layout.free_repo(repo)-    @free(path)+    @free(path as ref void)     if status != 0 {         stdio.eprint("selftest: fsck failed\n", {})         return 1--- a/src/src/core/buf.sx+++ b/src/src/core/buf.sx@@ -65,7 +65,7 @@     trust {         @store8(@ptradd(b.ptr, b.len as i64), v)     }-    b.len+++    b.len = b.len + 1 }  pub fn (Buf) put_u16_le(b: mut self, v: u16) void = {@@ -78,7 +78,7 @@     trust {         @store32(@ptradd(b.ptr, b.len as i64), v as i32)     }-    b.len += 4+    b.len = b.len + 4 }  pub fn (Buf) put_u64_le(b: mut self, v: u64) void = {@@ -86,7 +86,7 @@     trust {         @store64(@ptradd(b.ptr, b.len as i64), v)     }-    b.len += 8+    b.len = b.len + 8 }  pub fn (Buf) put_i16_le(b: mut self, v: i16) void = {@@ -103,7 +103,7 @@     }     Buf.reserve(b, n)     trust {-        @memcpy(@ptradd(b.ptr, b.len as i64), p, n)+        @memcpy(@ptradd(b.ptr, b.len as i64), p as ref void, n)     }     b.len = b.len + n }--- a/src/src/core/bytes.sx+++ b/src/src/core/bytes.sx@@ -59,7 +59,7 @@         if ca > cb {             return 1         }-        i+++        i = i + 1     }     if a.len < b.len {         return -1@@ -86,7 +86,7 @@         if ca != cb {             return false         }-        i+++        i = i + 1     }     return true }@@ -102,7 +102,7 @@ pub fn (Bytes) to_cstr(b: self) ref u8 = {     val out: ref u8 = @alloc(b.len + 1) as ref u8     if b.len > 0 {-        trust @memcpy(out, b.ptr, b.len)+        trust @memcpy(out as ref void, b.ptr as ref void, b.len)     }     trust @store8(@ptradd(out, b.len as i64), 0)     return out@@ -114,7 +114,7 @@         return empty()     }     val out: ref u8 = @alloc(b.len) as ref u8-    trust @memcpy(out, b.ptr, b.len)+    trust @memcpy(out as ref void, b.ptr as ref void, b.len)     return Bytes{ptr: out, len: b.len} } @@ -135,7 +135,7 @@         if trust @load8(@ptradd(b.ptr, i as i64)) != trust @load8(@ptradd(prefix.ptr, i as i64)) {             return false         }-        i+++        i = i + 1     }     return true }--- a/src/src/core/reader.sx+++ b/src/src/core/reader.sx@@ -43,7 +43,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u8 = trust @load8(@ptradd(r.data, r.pos as i64))-    r.pos+++    r.pos = r.pos + 1     return ok v } @@ -52,7 +52,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u16 = trust @load16(@ptradd(r.data, r.pos as i64))-    r.pos += 2+    r.pos = r.pos + 2     return ok v } @@ -61,7 +61,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u32 = trust (@load32(@ptradd(r.data, r.pos as i64)) as u32)-    r.pos += 4+    r.pos = r.pos + 4     return ok v } @@ -70,7 +70,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u64 = trust (@load64(@ptradd(r.data, r.pos as i64)) as u64)-    r.pos += 8+    r.pos = r.pos + 8     return ok v } @@ -102,8 +102,8 @@             }             return ok value         }-        shift += 7-        i+++        shift = shift + 7+        i = i + 1     }     return err derr.fail(derr.ErrorKind.VarintOverflow, start) }@@ -146,7 +146,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val start: usize = r.pos-    r.pos += 32+    r.pos = r.pos + 32     return ok trust @ptradd(r.data, start as i64) } --- a/src/src/crypto/blake3.sx+++ b/src/src/crypto/blake3.sx@@ -115,7 +115,7 @@         g(out, 1, 6, 11, 12, block_word(block, msg_word(r, 10)), block_word(block, msg_word(r, 11)))         g(out, 2, 7, 8, 13, block_word(block, msg_word(r, 12)), block_word(block, msg_word(r, 13)))         g(out, 3, 4, 9, 14, block_word(block, msg_word(r, 14)), block_word(block, msg_word(r, 15)))-        r+++        r = r + 1     }      val i: mut usize = 0@@ -124,7 +124,7 @@         val hi: u64 = ldw(out, i + 8)         stw(out, i, mask32(lo ^ hi))         stw(out, i + 8, mask32(hi ^ ldw(cv, i)))-        i+++        i = i + 1     } } @@ -132,7 +132,7 @@     val i: mut usize = 0     for i < n {         stw(dst, i, ldw(src, i))-        i+++        i = i + 1     } } @@ -181,7 +181,7 @@     for i + 1 < total {         @memset(blk, 0, 64)         val blk_ptr: ref u8 = @ptradd(data, (i * 64) as i64)-        @memcpy(blk, blk_ptr, 64)+        @memcpy(blk as ref void, blk_ptr as ref void, 64)         val cf: mut u64 = 0         if i == 0 {             cf = CHUNK_START@@ -188,7 +188,7 @@         }         compress_into(out_cv, blk, counter, 64, cf, state)         copy_words(out_cv, state, 8)-        i+++        i = i + 1     }      @memset(out_block, 0, 64)@@ -195,7 +195,7 @@     val last_len: usize = len - (i * 64)     if last_len > 0 {         val blk_ptr2: ref u8 = @ptradd(data, (i * 64) as i64)-        @memcpy(out_block, blk_ptr2, last_len)+        @memcpy(out_block as ref void, blk_ptr2 as ref void, last_len)     }     val start_flag: mut u64 = 0     if i == 0 {@@ -205,8 +205,8 @@     @store64(out_counter, counter)     @store64(out_block_len, last_len as u64) -    @free(blk)-    @free(state)+    @free(blk as ref void)+    @free(state as ref void) }  /// Pack two 32-byte chaining values into a parent block.@@ -214,9 +214,9 @@     set_iv(out_cv)     val i: mut usize = 0     for i < 8 {-        @store32(@ptradd(out_block, (i * 4) as i64), ldw(left, i) as i32)-        @store32(@ptradd(out_block, ((i + 8) * 4) as i64), ldw(right, i) as i32)-        i+++        @store32(@ptradd(out_block as ref void, (i * 4) as i64), ldw(left, i) as i32)+        @store32(@ptradd(out_block as ref void, ((i + 8) * 4) as i64), ldw(right, i) as i32)+        i = i + 1     } } @@ -267,7 +267,7 @@         val total_so_far: mut u64 = i + 1         for mask32(total_so_far & 1) == 0 {             pop_cv(stack, depth - 1, left)-            depth--+            depth = depth - 1             parent_output(left, new_cv, out_cv, out_block)             @store64(out_flags, PARENT)             @store64(out_counter, 0)@@ -276,8 +276,8 @@             total_so_far = total_so_far >> 1         }         push_cv(stack, depth, new_cv)-        depth++-        i+++        depth = depth + 1+        i = i + 1     }      val last_off: usize = (i as usize) * 1024@@ -295,7 +295,7 @@      for depth > 0 {         pop_cv(stack, depth - 1, left)-        depth--+        depth = depth - 1         output_cv(             out_cv,             out_block,@@ -324,18 +324,18 @@         val word: u64 = ldw(scratch, j / 4)         val byte: u8 = ((word >> ((j % 4) * 8)) & 255) as u8         @store8(@ptradd(out, j as i64), byte)-        j+++        j = j + 1     } -    @free(stack)-    @free(scratch)-    @free(out_cv)-    @free(out_block)-    @free(out_flags)-    @free(out_counter)-    @free(out_block_len)-    @free(chunk_cv)-    @free(new_cv)-    @free(left)-    @free(cur_cv)+    @free(stack as ref void)+    @free(scratch as ref void)+    @free(out_cv as ref void)+    @free(out_block as ref void)+    @free(out_flags as ref void)+    @free(out_counter as ref void)+    @free(out_block_len as ref void)+    @free(chunk_cv as ref void)+    @free(new_cv as ref void)+    @free(left as ref void)+    @free(cur_cv as ref void) }--- a/src/src/io/files.sx+++ b/src/src/io/files.sx@@ -36,7 +36,7 @@     val p: ref u8 = @alloc(n + 1) as ref u8     trust {         if a.len > 0 {-            @memcpy(p, a.ptr as ref void, a.len as usize)+            @memcpy(p as ref void, a.ptr as ref void, a.len as usize)         }         if need_sep == 1 {             @store8(@ptradd(p, a.len), 47)@@ -70,7 +70,7 @@     val out: ref u8 = @alloc(n + 1) as ref u8     trust {         if p.len > 0 {-            @memcpy(out, p.ptr as ref void, p.len as usize)+            @memcpy(out as ref void, p.ptr as ref void, p.len as usize)         }         if suffix.len > 0 {             @memcpy(@ptradd(out, p.len), suffix.ptr as ref void, suffix.len as usize)@@ -87,7 +87,7 @@         if c == 47 {             return trust str.slice(p, i + 1, p.len)         }-        i--+        i = i - 1     }     return p }@@ -152,11 +152,11 @@ }  pub fn write_all(p: str.StringView, data: bytes.Bytes) bool = {-    return trust fs.write_all_bytes(p, data.ptr, data.len as i64)+    return trust fs.write_all_bytes(p, data.ptr as ref void, data.len as i64) }  pub fn append_all(p: str.StringView, data: bytes.Bytes) bool = {-    return trust fs.append_all_bytes(p, data.ptr, data.len as i64)+    return trust fs.append_all_bytes(p, data.ptr as ref void, data.len as i64) }  pub fn mkdir_all(p: str.StringView) bool = {@@ -188,7 +188,7 @@  pub fn free_names(names: list[ref u8]) void = {     for n in names {-        val p: mut usize = n+        val p: mut ref void = n as ref void         trust @free(p)     }     @listfree(names)@@ -209,7 +209,7 @@         if a != b {             return false         }-        i+++        i = i + 1     }     return true }--- a/src/src/main.sx+++ b/src/src/main.sx@@ -46,7 +46,7 @@                 mut_path = str.from_cstr(a)             }         }-        i+++        i = i + 1     }     return fsck_cmd.run(mut_path, verbose) }--- a/src/src/object/blob.sx+++ b/src/src/object/blob.sx@@ -61,7 +61,7 @@  pub fn free_build(b: ref BlobBuild) void = {     raw.free_objects(b.objects)-    val p: mut ref BlobBuild = b+    val p: mut ref void = b as ref void     trust @free(p) } @@ -90,11 +90,11 @@  pub fn free_blob(b: ref Blob) void = {     for e in b.entries {-        val p: mut ref BlobEntry = e+        val p: mut ref void = e as ref void         trust @free(p)     }     @listfree(b.entries)-    trust @free(b)+    trust @free(b as ref void) }  /// Decode and validate a blob body.@@ -139,7 +139,7 @@         }         total = next_total         @append(b.entries, new_entry(objid.id(cid), length))-        i+++        i = i + 1     }     reader.Reader.finish(r)?     return ok b@@ -184,7 +184,7 @@             @append(out, new_group(start, current))             start = i + 1         }-        i+++        i = i + 1     }     return out }@@ -198,7 +198,7 @@         val node = node_at(nodes, group.start + i)         buf.Buf.put_id(b, node.id)         buf.Buf.put_varint(b, node.length)-        i+++        i = i + 1     }     return b }@@ -208,7 +208,7 @@     val i: mut usize = 0     for i < group.count {         total = total + node_at(nodes, group.start + i).length-        i+++        i = i + 1     }     return total }@@ -215,7 +215,7 @@  fn free_groups(groups: list[ref Group]) void = {     for g in groups {-        val p: mut ref Group = g+        val p: mut ref void = g as ref void         trust @free(p)     }     @listfree(groups)@@ -223,7 +223,7 @@  fn free_nodes(nodes: list[ref NodeRef]) void = {     for n in nodes {-        val p: mut usize = n+        val p: mut ref void = n as ref void         trust @free(p)     }     @listfree(nodes)--- a/src/src/object/commit.sx+++ b/src/src/object/commit.sx@@ -69,7 +69,7 @@     for i < n {         val p: ref u8 = reader.Reader.read_id(r)?         @append(out, objid.id(p))-        i+++        i = i + 1     }     return ok out }@@ -118,7 +118,7 @@         prev_parent = parent_index         prev_path = to         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -135,7 +135,7 @@             return err derr.fail(derr.ErrorKind.InvalidValue, at)         }         @append(out, new_kv(key, value))-        i+++        i = i + 1     }     return ok out }@@ -172,7 +172,7 @@     val i: mut usize = 0     for i < @len(c.parents) {         buf.Buf.put_id(b, id_at(c.parents, i).ptr)-        i+++        i = i + 1     }     buf.Buf.put_id(b, c.root_tree.ptr)     buf.Buf.put_raw(b, c.change_id.ptr, 16)@@ -199,7 +199,7 @@  fn free_renames(rs: list[ref Rename]) void = {     for r in rs {-        val p: mut reader.Reader = r+        val p: mut ref void = r as ref void         trust @free(p)     }     @listfree(rs)@@ -207,7 +207,7 @@  fn free_kvs(xs: list[ref prim.KeyValue]) void = {     for kv in xs {-        val p: mut ref prim.KeyValue = kv+        val p: mut ref void = kv as ref void         trust @free(p)     }     @listfree(xs)@@ -217,6 +217,6 @@     @listfree(c.parents)     free_renames(c.renames)     free_kvs(c.extra)-    val p: mut ref Commit = c+    val p: mut ref void = c as ref void     trust @free(p) }--- a/src/src/object/conflict.sx+++ b/src/src/object/conflict.sx@@ -70,7 +70,7 @@     val i: mut usize = 0     for i < n {         @append(out, read_value(r)?)-        i+++        i = i + 1     }     return ok out }@@ -154,15 +154,15 @@  pub fn free_conflict(c: ref Conflict) void = {     for v in c.adds {-        val p: mut ref ConflictValue = v+        val p: mut ref void = v as ref void         trust @free(p)     }     for v in c.removes {-        val p: mut ref ConflictValue = v+        val p: mut ref void = v as ref void         trust @free(p)     }     @listfree(c.adds)     @listfree(c.removes)-    val p2: mut ref Conflict = c+    val p2: mut ref void = c as ref void     trust @free(p2) }--- a/src/src/object/id.sx+++ b/src/src/object/id.sx@@ -88,7 +88,7 @@             @store8(@ptradd(out, (i * 2) as i64), hex_digit(v >> 4))             @store8(@ptradd(out, (i * 2 + 1) as i64), hex_digit(v & 15))         }-        i+++        i = i + 1     } } @@ -115,7 +115,7 @@             return false         }         trust @store8(@ptradd(out, i as i64), ((hi * 16 + lo) as u8))-        i+++        i = i + 1     }     return true }--- a/src/src/object/names.sx+++ b/src/src/object/names.sx@@ -25,7 +25,7 @@         if c == 0 || c == 47 {             return false         }-        i+++        i = i + 1     }     if is_dot_name(b) {         return false@@ -50,7 +50,7 @@         if c == 0 || c == 47 {             return false         }-        i+++        i = i + 1     }     return true }@@ -75,7 +75,7 @@             }             start = i + 1         }-        i+++        i = i + 1     }     return true }--- a/src/src/object/operation.sx+++ b/src/src/object/operation.sx@@ -33,7 +33,7 @@     for i < n {         val p: ref u8 = reader.Reader.read_id(r)?         @append(out, objid.id(p))-        i+++        i = i + 1     }     return ok out }@@ -50,7 +50,7 @@             return err derr.fail(derr.ErrorKind.InvalidValue, at)         }         @append(out, new_kv(key, value))-        i+++        i = i + 1     }     return ok out }@@ -86,7 +86,7 @@     val i: mut usize = 0     for i < @len(op.parents) {         buf.Buf.put_id(b, id_at(op.parents, i).ptr)-        i+++        i = i + 1     }     buf.Buf.put_id(b, op.view.ptr)     buf.Buf.put_time_ms(b, op.start)@@ -107,10 +107,10 @@ pub fn free_operation(op: ref Operation) void = {     @listfree(op.parents)     for kv in op.tags {-        val p: mut ref prim.KeyValue = kv+        val p: mut ref void = kv as ref void         trust @free(p)     }     @listfree(op.tags)-    val p2: mut ref Operation = op+    val p2: mut ref void = op as ref void     trust @free(p2) }--- a/src/src/object/raw.sx+++ b/src/src/object/raw.sx@@ -21,7 +21,7 @@             val body_ptr: mut ref void = o.body.ptr as ref void             trust @free(body_ptr)         }-        val obj_ptr: mut ref RawObject = o+        val obj_ptr: mut ref void = o as ref void         trust @free(obj_ptr)     }     @listfree(objects)--- a/src/src/object/tree.sx+++ b/src/src/object/tree.sx@@ -57,7 +57,7 @@         if trust @load8(@ptradd(id.ptr, i as i64)) != 0 {             return false         }-        i+++        i = i + 1     }     return true }@@ -98,7 +98,7 @@         @append(t.entries, entry(name, kind, objid.id(tid)))         prev = name         have_prev = true-        i+++        i = i + 1     }     reader.Reader.finish(r)?     return ok t@@ -131,7 +131,7 @@         buf.Buf.put_id(b, e.target.ptr)         prev = e.name         have_prev = true-        i+++        i = i + 1     }     val out: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     buf.Buf.free(b)@@ -140,10 +140,10 @@  pub fn free_tree(t: ref Tree) void = {     for e in t.entries {-        val p: mut ref TreeEntry = e+        val p: mut ref void = e as ref void         trust @free(p)     }     @listfree(t.entries)-    val p2: mut ref Tree = t+    val p2: mut ref void = t as ref void     trust @free(p2) }--- a/src/src/object/view.sx+++ b/src/src/object/view.sx@@ -64,7 +64,7 @@         if bytes.Bytes.at(b, i) == 0 {             return false         }-        i+++        i = i + 1     }     return true }@@ -91,7 +91,7 @@         @append(out, cur)         prev = cur         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -112,7 +112,7 @@             val p2: ref u8 = reader.Reader.read_id(r)?             @append(out, objid.id(p2))         }-        i+++        i = i + 1     }     return ok out }@@ -192,7 +192,7 @@         @append(out, bm)         prev = name         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -225,7 +225,7 @@         @append(out, t)         prev = name         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -275,7 +275,7 @@         prev_remote = remote         prev_name = name         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -308,7 +308,7 @@         @append(out, w)         prev = workspace         have_prev = true-        i+++        i = i + 1     }     return ok out }@@ -342,7 +342,7 @@     val i: mut usize = 0     for i < @len(v.heads) {         buf.Buf.put_id(b, id_at(v.heads, i).ptr)-        i+++        i = i + 1     }     buf.Buf.put_varint(b, @len(v.bookmarks) as u64)     for bm in v.bookmarks {@@ -379,25 +379,25 @@     @listfree(v.heads)     for bm in v.bookmarks {         free_target_set(bm.targets)-        val p: mut ref Bookmark = bm+        val p: mut ref void = bm as ref void         trust @free(p)     }     @listfree(v.bookmarks)     for t in v.tags {-        val p: mut ref TagRef = t+        val p: mut ref void = t as ref void         trust @free(p)     }     @listfree(v.tags)     for rr in v.remote_refs {-        val p: mut ref RemoteRef = rr+        val p: mut ref void = rr as ref void         trust @free(p)     }     @listfree(v.remote_refs)     for w in v.working_copies {-        val p: mut ref WorkspaceRef = w+        val p: mut ref void = w as ref void         trust @free(p)     }     @listfree(v.working_copies)-    val p2: mut ref View = v+    val p2: mut ref void = v as ref void     trust @free(p2) }--- a/src/src/store/fsck.sx+++ b/src/src/store/fsck.sx@@ -29,20 +29,20 @@ }  fn report(ctx: mut Ctx, path: str.StringView, msg: str.StringView) void = {-    ctx.errors+++    ctx.errors = ctx.errors + 1     trust stdio.eprint("fsck: {s}: {s}\n", {path, msg}) }  fn report_id(ctx: mut Ctx, path: str.StringView, msg: str.StringView, id: objid.Id) void = {-    ctx.errors+++    ctx.errors = ctx.errors + 1     val hx: ref u8 = objid.Id.hex(id)     trust stdio.eprint("fsck: {s}: {s} {s}\n", {path, msg, str.from_cstr(hx)})-    val p: mut ref u8 = hx+    val p: mut ref void = hx as ref void     trust @free(p) }  fn warn(ctx: mut Ctx, path: str.StringView, msg: str.StringView) void = {-    ctx.warnings+++    ctx.warnings = ctx.warnings + 1     if ctx.verbose {         trust stdio.eprint("fsck: warning: {s}: {s}\n", {path, msg})     }@@ -117,7 +117,7 @@         if !promised {             val msg: ref u8 = @fmtalloc("missing {s} object", {what})             report_id(ctx, path, str.from_cstr(msg), id)-            val mp: mut ref u8 = msg+            val mp: mut ref void = msg as ref void             @free(mp)         }         return promised@@ -128,7 +128,7 @@             {types.name(loc.kind), types.name(expected)}         )         report_id(ctx, path, str.from_cstr(msg2), id)-        val mp2: mut ref u8 = msg2+        val mp2: mut ref void = msg2 as ref void         @free(mp2)         return false     }@@ -359,7 +359,7 @@         {what, e.offset, derr.ErrorKind.name(e.kind)}     )     report(ctx, path, str.from_cstr(msg))-    val p: mut ref u8 = msg+    val p: mut ref void = msg as ref void     trust @free(p) } @@ -445,7 +445,7 @@     }     if eligible {         val visited: ref u8 = @alloc(p.count + 1) as ref u8-        @memset(visited, 0, p.count + 1)+        @memset(visited as ref void, 0, p.count + 1)         val j: mut usize = 0         for j < idx.count {             val iid: objid.Id = index.Index.id_at(idx, j)@@ -466,7 +466,7 @@                     report_id(ctx, pview, "index offset names no record for", iid)                 }             }-            j+++            j = j + 1         }         val k: mut usize = 0         for k < p.count {@@ -474,9 +474,9 @@                 report_id(ctx, pview, "record is not indexed", pack.Pack.id_at(p, k))                 eligible = false             }-            k+++            k = k + 1         }-        @free(visited)+        @free(visited as ref void)     }      if eligible {@@ -545,9 +545,9 @@                     report_decode(ctx, h.path, "record", e)                 }             }-            j+++            j = j + 1         }-        i+++        i = i + 1     } } @@ -613,7 +613,7 @@ fn check_op_log(ctx: mut Ctx, handles: list[ref store.Handle]) void = trust {     val dir: str.StringView = layout.op_heads_dir(ctx.repo)     if !files.exists_dir(dir) {-        report(ctx, dir, "missing op_heads directory")+        report(ctx, dir, "missing op-heads directory")         files.free_path(dir)         return     }@@ -622,14 +622,14 @@     for n in names {         val nv: str.StringView = str.from_cstr(n)         if nv.len != 64 {-            report(ctx, dir, "op_heads entry is not a 64-character id")+            report(ctx, dir, "op-heads entry is not a 64-character id")             continue         }         val raw_id: ref u8 = @alloc(32) as ref u8         val parsed: bool = objid.hex_decode(n, 32, raw_id)         if !parsed {-            report(ctx, dir, "op_heads entry is not hexadecimal")-            @free(raw_id)+            report(ctx, dir, "op-heads entry is not hexadecimal")+            @free(raw_id as ref void)             continue         }         @append(frontier, objid.id(raw_id))--- a/src/src/store/index.sx+++ b/src/src/store/index.sx@@ -62,7 +62,7 @@  pub fn free_index(idx: ref Index) void = {     files.free_buffer(idx.data)-    val p: mut ref Index = idx+    val p: mut ref void = idx as ref void     trust @free(p) } @@ -93,7 +93,7 @@         }         prev = v         last = v-        i+++        i = i + 1     }      val base: usize = 1032 + 64@@ -124,7 +124,7 @@         bytes.bytes(digest, 32),         bytes.Bytes.slice(data, index_trailer_off, data.len)     )-    trust @free(digest)+    trust @free(digest as ref void)     if !valid {         return err derr.fail(derr.ErrorKind.HashMismatch, index_trailer_off)     }@@ -133,7 +133,7 @@     }      val counts: ref u32 = @alloc(1024) as ref u32-    trust @memset(counts, 0, 1024)+    trust @memset(counts as ref void, 0, 1024)     val j: mut usize = 0     for j < count {         val cur: ref u8 = trust @ptradd(ids, (j * 32) as i64)@@ -141,33 +141,33 @@             val prev_id: ref u8 = trust @ptradd(ids, ((j - 1) * 32) as i64)             val c: i64 = compare_id(prev_id, cur)             if c == 0 {-                trust @free(counts)+                trust @free(counts as ref void)                 return err derr.fail(derr.ErrorKind.Duplicate, 1032 + j * 32)             }             if c > 0 {-                trust @free(counts)+                trust @free(counts as ref void)                 return err derr.fail(derr.ErrorKind.Unsorted, 1032 + j * 32)             }         }         val first: u8 = trust @load8(cur)-        val slot: ref u32 = trust @ptradd(counts, (first as i64) * 4) as ref u32+        val slot: ref u32 = trust @ptradd(counts as ref void, (first as i64) * 4) as ref u32         val c0: u32 = @load32(slot) as u32         @store32(slot, (c0 + 1) as i32)-        j+++        j = j + 1     }     val running: mut u32 = 0     val k: mut usize = 0     for k < 256 {-        val slot2: ref u32 = trust @ptradd(counts, (k as i64) * 4) as ref u32+        val slot2: ref u32 = trust @ptradd(counts as ref void, (k as i64) * 4) as ref u32         running = running + (@load32(slot2) as u32)         val stored: u32 = trust (@load32(@ptradd(data.ptr, (8 + k * 4) as i64)) as u32)         if stored != running {-            trust @free(counts)+            trust @free(counts as ref void)             return err derr.fail(derr.ErrorKind.Corrupt, 8 + k * 4)         }-        k+++        k = k + 1     }-    trust @free(counts)+    trust @free(counts as ref void)      val idx: mut ref Index = @alloc(@sizeof(Index)) as ref Index     idx.data = data@@ -183,10 +183,10 @@         trailer_len: pack_trailer.len == 32     }     val counts: ref u32 = @alloc(1024) as ref u32-    trust @memset(counts, 0, 1024)+    trust @memset(counts as ref void, 0, 1024)     for r in recs {         val first: u8 = trust @load8(r.id.ptr)-        val slot: ref u32 = trust @ptradd(counts, (first as i64) * 4) as ref u32+        val slot: ref u32 = trust @ptradd(counts as ref void, (first as i64) * 4) as ref u32         val c0: u32 = @load32(slot) as u32         @store32(slot, (c0 + 1) as i32)     }@@ -197,10 +197,10 @@     val running: mut u32 = 0     val k: mut usize = 0     for k < 256 {-        val slot2: ref u32 = trust @ptradd(counts, (k as i64) * 4) as ref u32+        val slot2: ref u32 = trust @ptradd(counts as ref void, (k as i64) * 4) as ref u32         running = running + (@load32(slot2) as u32)         buf.Buf.put_u32_le(b, running)-        k+++        k = k + 1     }     for r in recs {         buf.Buf.put_id(b, r.id.ptr)@@ -213,8 +213,8 @@     val digest: ref u8 = @alloc(32) as ref u8     trust b3.hash(b.ptr, b.len, digest)     buf.Buf.put_raw(b, digest, 32)-    trust @free(digest)-    trust @free(counts)+    trust @free(digest as ref void)+    trust @free(counts as ref void)      val out: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     buf.Buf.free(b)--- a/src/src/store/layout.sx+++ b/src/src/store/layout.sx@@ -63,10 +63,10 @@             if c == 47 {                 break             }-            last--+            last = last - 1         }         if last <= 0 {-            val p: mut ref u8 = cpath+            val p: mut ref void = cpath as ref void             trust @free(p)             return none         }@@ -88,7 +88,7 @@ }  pub fn op_heads_dir(r: Repo) str.StringView = {-    return files.join(root_view(r), ".vein/op_heads")+    return files.join(root_view(r), ".vein/op-heads") }  pub fn config_path(r: Repo) str.StringView = {@@ -101,9 +101,61 @@  fn mkdirs_under(r: Repo, sub: str.StringView) bool = {     val p: str.StringView = files.join(root_view(r), sub)+    if files.exists_dir(p) {+        files.free_path(p)+        return true+    }     val created: bool = files.mkdir_all(p)     files.free_path(p)     return created+}++fn migrate_dir(r: Repo, old_sub: str.StringView, new_sub: str.StringView) bool = {+    val oldp: str.StringView = files.join(root_view(r), old_sub)+    val newp: str.StringView = files.join(root_view(r), new_sub)+    val old_exists: bool = files.exists_dir(oldp)+    val new_exists: bool = files.exists_dir(newp)+    val moved: mut bool = true+    if old_exists && !new_exists {+        moved = files.rename_path(oldp, newp)+    }+    files.free_path(oldp)+    files.free_path(newp)+    return moved+}++fn ensure_layout(r: Repo) bool = {+    if !migrate_dir(r, ".vein/op_heads", ".vein/op-heads") {+        return false+    }+    if !migrate_dir(r, ".vein/working_copy", ".vein/working-copy") {+        return false+    }+    if !mkdirs_under(r, ".vein") {+        return false+    }+    if !mkdirs_under(r, ".vein/store") {+        return false+    }+    if !mkdirs_under(r, ".vein/store/packs") {+        return false+    }+    if !mkdirs_under(r, ".vein/store/tmp") {+        return false+    }+    if !mkdirs_under(r, ".vein/op-heads") {+        return false+    }+    if !mkdirs_under(r, ".vein/git-map") {+        return false+    }+    if !mkdirs_under(r, ".vein/working-copy") {+        return false+    }+    if !mkdirs_under(r, ".vein/resolutions") {+        return false+    }+    return true }  /// Create a repository at `root`. Idempotent when the format file exists.@@ -119,7 +171,8 @@     }     val repo: Repo = Repo{root: bytes.from_cstr(cpath)}     val format: str.StringView = format_path(repo)-    if files.exists_file(format) {+    val had_format: bool = files.exists_file(format)+    if had_format {         val existing = files.read_all(format)         files.free_path(format)         if existing is some data {@@ -129,53 +182,29 @@                 free_repo(repo)                 return err 2             }-            return ok repo+        } else {+            free_repo(repo)+            return err 3         }-        free_repo(repo)-        return err 3+    } else {+        files.free_path(format)     }-    files.free_path(format) -    if !mkdirs_under(repo, ".vein") {+    if !ensure_layout(repo) {         free_repo(repo)         return err 4-    }-    if !mkdirs_under(repo, ".vein/store") {-        free_repo(repo)-        return err 13-    }-    if !mkdirs_under(repo, ".vein/store/packs") {-        free_repo(repo)-        return err 5-    }-    if !mkdirs_under(repo, ".vein/store/tmp") {-        free_repo(repo)-        return err 6-    }-    if !mkdirs_under(repo, ".vein/op_heads") {-        free_repo(repo)-        return err 7-    }-    if !mkdirs_under(repo, ".vein/git-map") {-        free_repo(repo)-        return err 8-    }-    if !mkdirs_under(repo, ".vein/working_copy") {-        free_repo(repo)-        return err 9-    }-    if !mkdirs_under(repo, ".vein/resolutions") {-        free_repo(repo)-        return err 10     } -    val fp: str.StringView = format_path(repo)-    val wrote: bool = files.write_all(fp, format_text())-    files.free_path(fp)-    if !wrote {-        free_repo(repo)-        return err 11+    if !had_format {+        val fp: str.StringView = format_path(repo)+        val wrote: bool = files.write_all(fp, format_text())+        files.free_path(fp)+        if !wrote {+            free_repo(repo)+            return err 11+        }     }+     val cp: str.StringView = config_path(repo)     if !files.exists_file(cp) {         val empty: bytes.Bytes = bytes.empty()--- a/src/src/store/pack.sx+++ b/src/src/store/pack.sx@@ -124,7 +124,7 @@     trust @free(p.stored_lens as ref void)     trust @free(p.data_offs as ref void)     trust @free(p.rec_offs as ref void)-    val q: mut ref Pack = p+    val q: mut ref void = p as ref void     trust @free(q) } @@ -162,7 +162,7 @@     val digest: ref u8 = @alloc(32) as ref u8     b3.hash(data.ptr, body_end, digest)     val valid: bool = bytes.Bytes.eql(bytes.bytes(digest, 32), trailer)-    @free(digest)+    @free(digest as ref void)     if !valid {         return err derr.fail(derr.ErrorKind.HashMismatch, body_end)     }@@ -185,7 +185,7 @@     for i < count {         val rec_off: usize = reader.Reader.offset(r)         val idp: ref u8 = reader.Reader.read_id(r)?-        @memcpy(@ptradd(ids, (i * 32) as i64), idp, 32)+        @memcpy(@ptradd(ids, (i * 32) as i64), idp as ref void, 32)         @store64(@ptradd(rec_offs, (i * 8) as i64), rec_off as u64)          val kind: u8 = reader.Reader.read_u8(r)?@@ -217,7 +217,7 @@         @store64(@ptradd(stored_lens, (i * 8) as i64), stored_len)         @store64(@ptradd(data_offs, (i * 8) as i64), reader.Reader.offset(r) as u64)         val _ = reader.Reader.read_raw(r, stored_len as usize)?-        i+++        i = i + 1     }     if reader.Reader.offset(r) != body_end {         return err derr.fail(derr.ErrorKind.TrailingBytes, reader.Reader.offset(r))@@ -250,7 +250,7 @@     val stored: bytes.Bytes = Pack.stored(p, i)     if comp == 0 {         val out: ref u8 = @alloc(raw_len) as ref u8-        trust @memcpy(out, stored.ptr as ref void, raw_len)+        trust @memcpy(out as ref void, stored.ptr as ref void, raw_len)         return ok bytes.bytes(out, raw_len)     }     val decoded = zstd.decompress(stored, raw_len)@@ -322,7 +322,7 @@     val digest: ref u8 = @alloc(32) as ref u8     trust b3.hash(b.ptr, b.len, digest)     buf.Buf.put_raw(b, digest, 32)-    trust @free(digest)+    trust @free(digest as ref void)      val pack_bytes: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     val pack_trailer: bytes.Bytes = bytes.Bytes.slice(--- a/src/src/store/records.sx+++ b/src/src/store/records.sx@@ -61,11 +61,11 @@             if objid.Id.cmp(rj.id, rmin.id) < 0 {                 min = j             }-            j+++            j = j + 1         }         if min != i {             swap(at(records, i), at(records, min))         }-        i+++        i = i + 1     } }--- a/src/src/store/store.sx+++ b/src/src/store/store.sx@@ -54,7 +54,7 @@         pack.free_pack(h.pack)         index.free_index(h.idx)         files.free_path(h.path)-        val p: mut ref Handle = h+        val p: mut ref void = h as ref void         trust @free(p)     }     @listfree(handles)@@ -98,7 +98,7 @@                 return true             }         }-        i+++        i = i + 1     }     return false }@@ -293,7 +293,7 @@         if bytes.Bytes.eql(bytes.Bytes.slice(hay, i, i + needle.len), needle) {             return true         }-        i+++        i = i + 1     }     return false }--- a/src/src/store/zstd.sx+++ b/src/src/store/zstd.sx@@ -38,7 +38,7 @@     }     val dst: ref u8 = @alloc(bound) as ref u8     val n: usize = trust ZSTD_compress(-        dst,+        dst as ref void,         bound,         src.ptr as ref void,         src.len,@@ -45,7 +45,7 @@         level     )     if trust ZSTD_isError(n) != 0 || n >= src.len {-        trust @free(dst)+        trust @free(dst as ref void)         return bytes.empty()     }     return bytes.bytes(dst, n)@@ -59,13 +59,13 @@     }     val dst: ref u8 = @alloc(raw_len) as ref u8     val n: usize = trust ZSTD_decompress(-        dst,+        dst as ref void,         raw_len,         src.ptr as ref void,         src.len     )     if trust ZSTD_isError(n) != 0 || n != raw_len {-        trust @free(dst)+        trust @free(dst as ref void)         return none     }     return some bytes.bytes(dst, raw_len)