An experimental Rust compiler backend that transpiles Rust code into .NET assemblies or C source files.
rustc_codegen_clr is an experimental Rust compiler backend that transpiles Rust code into .NET assemblies or C source files. It solves the problem of using Rust in environments dominated by .NET or C by providing seamless interop and code generation capabilities.
Rust developers looking to integrate Rust code into .NET applications or C-based projects, and .NET developers seeking to leverage Rust's safety and performance in their ecosystems.
Developers choose rustc_codegen_clr because it enables Rust code to run within the .NET runtime without external libraries, provides a shared codebase for both .NET and C targets, and offers safety-checked interop layers that reduce common integration issues.
A Rust compiler backend targeting CIL(.NET IR) and C.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables easy interaction with .NET code from Rust, as shown with examples like StringBuilder, allowing integration into existing .NET codebases without external libraries.
Uses a shared codebase for .NET and C backends, meaning bug fixes and improvements apply to both targets simultaneously, reducing maintenance overhead as described in the philosophy.
The Rust compiler verifies the interop layer's safety, minimizing common interop issues and enhancing reliability, as highlighted in the safety guarantees.
Allows defining .NET classes directly in Rust via early WIP syntax, making Rust APIs natively accessible to C# and F#, facilitating code reuse across languages.
The project is in early development with warnings about bugs and crashes; std tests show failure rates up to 10.31% in .NET, making it unreliable for serious use.
Primarily tested only on Linux x86_64 with .NET 8, and support for other platforms or runtimes like Mono is incomplete with missing features, as admitted in the FAQ.
Many components of std are not fully functional, with core and alloc tests indicating partial support (e.g., 89.69% pass rate for std in .NET), limiting usability.
Lack of .NET-specific std or target triples requires separate assemblies for each operating system, increasing deployment overhead, as noted in the compatibility section.