Tmux-rs: A 100k LOC Journey from C to (Unsafe) Rust
2025-07-03
Over six months, the author painstakingly ported the ~67,000 lines of C code behind tmux, the terminal multiplexer, to Rust, resulting in a ~81,000 line codebase. Initial attempts using the C2Rust transpiler proved unwieldy, leading to a manual rewrite. The author details the build process, encountered bugs, and strategies for converting C idioms to Rust, including handling raw pointers, goto statements, and intrusive macros. The project culminates in a lalrpop-based reimplementation of the yacc parser, achieving a complete C-to-Rust migration and culminating in a 0.0.1 release. The journey showcases the challenges and rewards of large-scale code porting.
Development
C to Rust