Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. c2rust

c2rust

NOASSERTIONRustv0.22.1

A transpiler that migrates C99-compliant code to unsafe Rust, preserving functionality and enabling incremental refactoring.

Visit WebsiteGitHubGitHub
4.7k stars301 forks0 contributors

What is c2rust?

C2Rust is a transpiler that converts C99-compliant code into unsafe Rust, enabling the migration of legacy C projects to the Rust ecosystem. It focuses on preserving the original functionality so that existing test suites continue to pass after translation. The project also includes refactoring tools to help developers incrementally improve the safety and idiomatic quality of the generated Rust code.

Target Audience

Developers and teams maintaining legacy C codebases who want to migrate to Rust for memory safety and modern tooling, particularly those working on systems software, libraries, or embedded projects.

Value Proposition

C2Rust provides a pragmatic, incremental path to Rust adoption by automating the initial translation of C code, which can then be refined. Its integration with standard build systems and focus on correctness makes it a practical choice for real-world migration projects.

Overview

Migrate C code to Rust

Use Cases

Best For

  • Migrating well-tested C libraries to Rust with minimal initial breakage
  • Incrementally modernizing legacy systems software written in C
  • Converting C projects that use build systems like CMake or Meson
  • Research and experimentation in source-to-source translation from C to Rust
  • Teams adopting Rust who need to bring existing C dependencies along
  • Creating Rust bindings for C libraries by first transpiling then refactoring

Not Ideal For

  • Projects requiring immediate production-safe, idiomatic Rust without post-translation refactoring
  • Teams lacking expertise in C build systems or unable to generate compile_commands.json
  • Codebases using C features beyond C99 or platform-specific intrinsics unsupported by the translator
  • Windows-based development environments, as C2Rust only officially supports Linux and macOS

Pros & Cons

Pros

Functional Preservation

C2Rust ensures translated Rust code passes existing C test suites, maintaining correctness during migration as stated in the README's primary goal.

Build System Integration

It works seamlessly with CMake, Meson, Bear, and other tools to generate compilation databases, easing integration into existing C workflows.

Incremental Refactoring Path

The c2rust-refactor tool assists in automating the transition from unsafe to safer Rust, though it's admitted to be in early development.

Cross-Checking Support

Allows verification of translated code against the original C implementation, adding a layer of correctness assurance for critical projects.

Cons

Early-Stage Refactoring Tools

The refactoring tools are 'still in the early stages' per the README, requiring significant manual effort to achieve safe, idiomatic Rust.

Complex Setup and Dependencies

Installation requires specific LLVM versions, clang, and system dependencies like openssl, which can be cumbersome and error-prone across platforms.

Outdated Documentation

The official manual hasn't been updated since 2019, forcing users to rely on in-tree docs that may be incomplete, as noted in the README.

Platform Limitations

C2Rust only supports Linux and macOS, excluding Windows and other systems, which restricts its use for cross-platform migrations.

Frequently Asked Questions

Quick Stats

Stars4,719
Forks301
Contributors0
Open Issues308
Last commit2 days ago
CreatedSince 2018

Tags

#legacy-modernization#migration#transpiler#rust-tooling#memory-safety#security-hardening#c-to-rust#code-migration#llvm#rust#refactoring#translation

Built With

L
LLVM
C
Clang
R
Rust
C
CMake
P
Python

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 21 hours ago

Related Projects

m2cgenm2cgen

Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies

Stars2,988
Forks263
Last commit1 year ago
corrodecorrode

C to Rust translator

Stars2,186
Forks117
Last commit7 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub