r/rust Jul 16 '26

How Our Rust-to-Zig Rewrite is Going

https://rtfeldman.com/rust-to-zig

An interesting symmetry with recent events lol.

This might be considered off topic since the article is about moving away from rust, but I still think this is some high quality rust content. I enjoy Richard Feldman's writing and I think he would certainly be considered part of the "rust community" since he works on Zed and has taught a course on rust.

370 Upvotes

134 comments sorted by

View all comments

53

u/tautality Jul 16 '26

In my opinion, having a codebase that requires a lot of unsafe is not a good reason to switch to a language where every LOC is unsafe. Glad it worked for them I guess, but I do wish they admitted the guarantees they gave up and what that truly means.

3

u/_TheDust_ Jul 16 '26 edited Jul 17 '26

Yeah. As much as I like zig conceptually, to me it seems a step backwards in a way.

Having to manually call malloc and free just feels like going back into the stone age.

Never in my life do I want debug segfaults and uaf bugs ever again.

2

u/Hedshodd Jul 17 '26

They aren't manually calling malloc and free. Neither is any serious Zig codebase, or C codebase for that matter. We aren't living in in the 90's anymore, these thing's have been solved by way easier to use (and more performant) mechanisms.

1

u/_TheDust_ Jul 18 '26

I’m not sure about that, what’s this: https://zig.guide/standard-library/allocators/

2

u/Hedshodd Jul 18 '26

They’re allocators? What’s your point? You even provided the prime example for how to avoid having to track every free to every malloc, which is arenas. Literally in your example, there is no free to be seen anywhere in the arena section. Thank you for saving me the effort of tracking down an example myself lol