Remix.run Logo
dnautics a day ago

> how about from the other direction, adding some kind of borrow checker to Zig? That sounds more within reach and practically achievable, possibly even in userland.

It's doable, and as static analysis. see sibling comment.

Ar-Curunir a day ago | parent [-]

No, it would fundamentally change how Zig works.

dnautics a day ago | parent [-]

no, it would not. If you do not believe me, you should try out the repo.

Ar-Curunir a day ago | parent [-]

the architecture doesn't make sense. MIRI doesn't perform static analysis on MIR. It is, as the name says, an interpreter. The borrow checker is entirely different from miri.

Rust's borrow checker requires lifetime annotations. Zig code doesn't contain any such annotations. How does your design handle this?

dnautics 7 hours ago | parent [-]

1. it is possible to do code annotations in zig even though i havent implemented it in this iteration of clr (the first poc demonstrated this). i want to see how far i can get without them.

2. let's take double free (easiest to explain).

you dont have to tag ownership, you can be agnostic about who should free, and merely report if two nondisjoint code paths attempt to free the same memory.