Story Details

  • Rust to C compiler – 95.9% test pass rate, odd platforms

    Posted: 2025-04-12 04:21:15

    The cg_clif project has made significant progress in compiling Rust to C, achieving a 95.9% pass rate on the Rust test suite. This compiler leverages Cranelift as a backend and utilizes a custom ABI for passing Rust data structures. Notably, it's now functional on more unusual platforms like wasm32-wasi and thumbv6m-none-eabi (for embedded ARM devices). While performance isn't a primary focus currently, basic functionality and compatibility are progressing rapidly, demonstrating the potential for compiling Rust to a portable C representation.

    Summary of Comments ( 164 )
    https://news.ycombinator.com/item?id=43661329

    Hacker News users discussed the impressive 95.9% test pass rate of the Rust-to-C compiler, particularly its ability to target unusual platforms like the Sega Saturn and Sony PlayStation. Some expressed skepticism about the practical applications, questioning the performance implications and debugging challenges of such a complex transpilation process. Others highlighted the potential benefits for code reuse and portability, enabling Rust code to run on legacy or resource-constrained systems. The project's novelty and ambition were generally praised, with several commenters expressing interest in the developer's approach and future developments. Some also debated the suitability of "compiler" versus "transpiler" to describe the project. There was also discussion around specific technical aspects, like memory management and the handling of Rust's borrow checker within the C output.