Hacker News new | ask | show | jobs
by zamalek 17 days ago
That is an absolutely massive amount of unsafe, is the plan to reduce it over time? The benefits of the Rust build system are reason alone to use this (as a direct competitor to the C version), but claims about memory safety are suspect no matter how confident the authors are about correctness.
1 comments

they're using c2rust. It transpiles c -> rust "directly", e.g. ints map to libc::c_int, pointers map to pointers, array access map to dereferencing pointers at an offset, etc.

Typically the suggested way to use it is to obtain "bad" rust directly from it (but which still works etc), and then make that "bad" rust more idiomatic. I don't remember any publicly visible success stories for this though. The current Bun rewrite is arguably of this form, but not exactly a "success story" in producing idiomatic, safe rust. Other large rewrites that were well-publicized/docoument, e.g. the fish shell from c++ -> Rust, took a different approach (factor into modules/rewrite each module by hand).

https://fishshell.com/blog/rustport/