The C to Rust migration book

LukeMathWalker 23 points 22 comments July 01, 2026
mainmatter.com · View on Hacker News

Discussion Highlights (7 comments)

b40d-48b2-979e

and cheadergen, Mainmatter's tool for the reverse direction So this is just an ad blogpost for the company.

matltc

I've spent a good amount of time with C, nowhere near mastery though. Is it worth still writing C, or better off just learning Rust if my goal is to write embedded/systems code?

yablak

One link deeper is the actual content; can we link there instead? https://mainmatter.com/c-to-rust-migration-book/course/

tallesborges92

Please do a skill

TaupeRanger

"Use Claude" [the end]

malisper

I made a comment about this yesterday[0], but there's been a massive increase in people migrating from C to Rust due to LLMs. In contrast to what the C to Rust migration book is recommending (using FFI to integrate Rust with C), I've found it much easier to start from scratch. I recently finished a project where I rewrote Postgres in Rust[1]. For context, Postgres is about one million lines of C code. On one attempt, I tried using c2rust to convert Postgres into unsafe Rust code. That attempt succeeded in terms of getting working "Rust" code, but any attempt to change any piece to safe rust, would require thousands of changes across codebase. Even though I had working Rust code, I found it infeasible to get to working idiomatic Rust code. Instead what I found to be more effective was starting a new codebase and rewrite each file from the Postgres codebase into Rust one at a time. This allowed me to guarantee that at all times the new codebase was idiomatic and simultaneously I could make one pass over the Postgres codebase to get working idiomatic Rust. YMMV, but I found it way easier to generate a whole new codebase from scratch rather than incrementally rewrite an existing codebase. [0] https://news.ycombinator.com/item?id=48738985#48739882 [1] https://github.com/malisper/pgrust

TazeTSchnitzel

The “Table of Contents” in the article ( https://mainmatter.com/c-to-rust-migration-book/ ) looks like the very basic stuff and not especially interesting, but then the headings in the book itself ( https://mainmatter.com/c-to-rust-migration-book/course/ ) look much more in-depth and don't seem to map onto the supposed ToC. I think they're misusing that term? I guess it's aspirational too as the book isn't finished yet.

Semantic search powered by Rivestack pgvector
14,015 stories · 131,331 chunks indexed