c2rust

Migrate C code to Rust (by immunant)

C2rust Alternatives

Similar projects and alternatives to c2rust

  1. rust

    2,831 c2rust VS rust

    Empowering everyone to build reliable and efficient software.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. TypeScript

    1,425 c2rust VS TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  4. Transmission

    Official Transmission BitTorrent client repository

  5. too-many-lists

    Learn Rust by writing Entirely Too Many linked lists

  6. swc

    156 c2rust VS swc

    Rust-based platform for the Web

  7. dmd

    dmd D Programming Language compiler

  8. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  9. MeiliSearch

    A lightning-fast search engine API bringing AI-powered hybrid search to your sites and applications.

  10. min-sized-rust

    🦀 How to minimize Rust binary size 📦

  11. RustPython

    101 c2rust VS RustPython

    A Python Interpreter written in Rust

  12. nomicon

    89 c2rust VS nomicon

    The Dark Arts of Advanced and Unsafe Rust Programming

  13. abseil-cpp

    Abseil Common Libraries (C++)

  14. Puma

    43 c2rust VS Puma

    A Ruby/Rack web server built for parallelism

  15. subsurface

    This is the official upstream of the Subsurface divelog program

  16. datatype99

    Algebraic data types for C99

  17. ixy-languages

    A high-speed network driver written in C, Rust, C++, Go, C#, Java, OCaml, Haskell, Swift, Javascript, and Python

  18. feather

    20 c2rust VS feather

    A Minecraft server implementation in Rust (by feather-rs)

  19. obake

    2 c2rust VS obake

    Versioned data-structures for Rust

  20. rtorrent

    45 c2rust VS rtorrent

    rTorrent BitTorrent client

  21. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better c2rust alternative or higher similarity.

c2rust discussion

Log in or Post with

c2rust reviews and mentions

Posts with mentions or reviews of c2rust. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2025-04-12.
  • Rust to C compiler – 95.9% test pass rate, odd platforms
    8 projects | news.ycombinator.com | 12 Apr 2025
    Tools like those exist. The problem with them is that they use unsafe blocks a lot, and the code usually isn't very idiomatic. Translating global variable state machines into more idiomatic Rust state machines based on things like named enums, for instance, would be very difficult.

    Still, if you're looking to take a C project and extend it in Rust, or perhaps slowly rewrite it piece by piece, https://c2rust.com/ is ready for action.

  • DARPA suggests turning old C code automatically into Rust – using AI, of course
    1 project | news.ycombinator.com | 3 Aug 2024
    Converting C to legal (unsafe) Rust is quite possible; there is indeed already a tool that does this (https://github.com/immunant/c2rust).

    The problem you run into is that the conversion is so pedantically correct that the resulting code is useless. The result retains all of the problems that the C code has, and is so far from idiomatic Rust that it's easier to toss the code and start from scratch. Progressive lifting on unsafe Rust to safe Rust is a very difficult order, and the tool I mentioned had a tool to do that... which is now abandoned and unmaintained.

    At the end of the day, the chief issue with converting to safe Rust is not just that you have to copy semantics over, but you also have to recover a lot of high-level preconditions. Turning pointers into slices is perhaps the easiest task of the lot; given the very strict mutability rules in Rust, you also have to work out when and where to insert things like Cell or Rc or Mutex or what have you, as well as building out lifetime analysis. And chances are the original code doesn't get all these rules right, which is why there are bugs in the first place.

    Solving that problem is the goal of this DARPA proposal, or perhaps more accurately, determining how feasible it is to solve that problem automatically. Personally, I think the better answer is to have a semi-automated approach, where users provide as input the final Rust struct layouts (and possibly parts of the API, to fix lifetime issues), and the tool automates the drudgery of getting the same logic ported to that mapping.

  • DARPA: Translating All C to Rust (Tractor)
    5 projects | news.ycombinator.com | 30 Jul 2024
    This working C to Rust transpiler is really interesting: https://github.com/immunant/c2rust
  • Converting the Kernel to C++
    3 projects | news.ycombinator.com | 10 Jan 2024
    A recent practical example of the former: the fish shell re-wrote incrementally from C++ to Rust, and is almost finished https://github.com/fish-shell/fish-shell/discussions/10123

    An example of the latter: c2rust, which is a work in progress but is very impressive https://github.com/immunant/c2rust

    It currently translates into unsafe Rust, but the strategy is to separate the "compile C to unsafe Rust" steps and the "compile unsafe Rust to safe Rust" steps. As I see it, as it makes the overall task simpler, allows for more user freedom, and makes the latter potentially useful even for non-transpiled code. https://immunant.com/blog/2023/03/lifting/

  • Best tools to convert code between languages?
    1 project | /r/learnprogramming | 11 Apr 2023
    But not all transpilers are between languages where at least one of them is designed to be transpiled. For example, c2rust can transpile, as the name suggests, C to (ugly, unsafe) Rust. A while ago there was a Java -> C compiler in GCC (GCJ), but it's pretty out of date now.
  • Translate C code to Rust working with libc
    1 project | /r/rust | 3 Apr 2023
    I do not know about your specific issue but you may be interested by https://github.com/immunant/c2rust
  • Rewrite in Rust or Use Rust-bindings
    1 project | /r/rust | 21 Mar 2023
    You should also consider using C2Rust (they're even working on C -> safe Rust translation)
  • Emitting Safer Rust with C2Rust
    3 projects | news.ycombinator.com | 15 Mar 2023
    > The date at the bottom of the article is 2022-06-13. Has there been further progress?

    The article links to their github repo:

    https://github.com/immunant/c2rust

    There's commits in the last hour, so at least some signal of life.

  • Writing an OS in Rust to run on RISC-V
    8 projects | news.ycombinator.com | 1 Mar 2023
    This is arguably already the state of things.

    Rust might get compiled down through MIR, down through LLVM IR, down to assembly or wasm... which then might be JIT or AOT (re)compiled into other bytecodes... which might perhaps be decompiled back up to C... and C might be retranslated back to horrific unsafe-spamming Rust by the likes of https://c2rust.com/. We've come full circle!

    The main issue is that retranslating high level languages into other high level languages isn't something that there's actually a lot of demand for, especially commercially, especially given the N x M translation matrix going on. So a lot of the projects "stabilize" (get abandoned). And automatically translating between the idioms of those languages gets even nastier in terms of matrix bloat.

    Well, you've got stuff like MSIL and JVM bytecodes which are higher level, and preserve more type information, and can be compiled to / decompiled from while still preserving more structure, but they still form competing incompatible ecosystems.

  • Will Carbon Replace C++?
    14 projects | news.ycombinator.com | 27 Feb 2023
    That's the wrong direction. What's needed are intelligent converters which convert less-strict languages to more-strict ones.

    Non-intelligent converters just make a mess. Here's c2rust.[1]

    Classic C++ to modern C++, plus a compiler flag to lock out all the old unsafe stuff, would be an achievement.

    [1] https://c2rust.com/

  • A note from our sponsor - InfluxDB
    www.influxdata.com | 24 May 2025
    InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now. Learn more →

Stats

Basic c2rust repo stats
50
4,231
9.1
5 days ago

Sponsored
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com

Did you know that Rust is
the 5th most popular programming language
based on number of references?