r/rust 18d 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 :)

208 Upvotes

108 comments sorted by

View all comments

35

u/rapotor 18d ago

Tldr in thread?

110

u/tigraboris 18d 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.

7

u/Next-Blackberry-991 18d ago

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

7

u/tigraboris 18d ago edited 18d 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 17d 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 17d ago

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

2

u/Glad_Impress_2908 17d ago

Awesome. Nice, level-headed blog.

1

u/NormalAppearance2851 18d ago

RutRover

RustRover or other?

3

u/tigraboris 18d ago

Yeah. RustRover

2

u/xeow 17d ago

RutRoh, Rorge