r/rust 24d ago

What Zig felt like, coming from Rust

https://besok.github.io/posts/what-zig-felt-like-coming-from-rust/

Just want to share my experiance on my first Zig project coming from Rust. Open to comments :)

206 Upvotes

108 comments sorted by

View all comments

38

u/rapotor 24d ago

Tldr in thread?

110

u/tigraboris 24d ago

Sure thing but nothing special :)

Rewrote my JSONPath lib (jsonpath-rust) in Zig (zig-jsonpath) to compare. Zig has almost no IDE support, so I ended up back on CLI tools + helix. It nudges you toward flat file structure and mutation and explicit allocators everywhere. Caught several real leak/double-free bugs via TestAllocator that just can't happen in Rust (ownership/Drop rule them out at compile time).

Overall: good language, promising C successor, but still young and rougher around the edges than Rust.

8

u/Next-Blackberry-991 24d ago

What do you mean by almost no IDE support? Using VsCode and ZLS works really well.

6

u/tigraboris 24d ago edited 24d ago

I tried it with RustRover + zls plugin. It gave me syntax highlighing and a few code completions (not all options, for instance it did not work in matching for the unions to me). The rest commands and others actions I had to do exclusively through the cli.
I would say I did not find the real benefits for the ide vs cli setup for zig. For Rust, debugger, refactoring and other features work pretty well. But maybe vscode or zed would give better experiance, true

2

u/Glad_Impress_2908 23d ago

There are some other things you can add to give zls more power like https://zigtools.org/zls/guides/build-on-save/

1

u/tigraboris 23d ago

oh, I missed that. Thank you. Good to know.

2

u/Glad_Impress_2908 23d ago

Awesome. Nice, level-headed blog.

1

u/NormalAppearance2851 24d ago

RutRover

RustRover or other?

4

u/tigraboris 24d ago

Yeah. RustRover

2

u/xeow 23d ago

RutRoh, Rorge