Hasty Briefsbeta

Bilingual

Introducing tmux-rs

10 months ago
  • #Rust
  • #C-to-Rust
  • #tmux
  • Collin Richards ported tmux from C to Rust as a hobby project, reaching a milestone of 100% Rust code.
  • The initial approach used C2Rust, but the generated code was unmaintainable, leading to a manual rewrite.
  • The build process evolved from linking Rust into a C binary to building a Rust binary with a C library, using the `cc` crate.
  • Several interesting bugs were encountered, including type mismatches and incorrect function declarations.
  • C patterns like raw pointers and `goto` were translated into Rust, with challenges around Rust's safety guarantees.
  • Intrusive macros for data structures like red-black trees and linked lists were reimplemented in Rust.
  • The Yacc parser was replaced with `lalrpop`, enabling the removal of all remaining C code.
  • Development tools included Vim with custom macros and AI tools like Cursor, though manual review was still necessary.
  • The project aims to transition to safe Rust next, despite current stability issues.