crustc: rustc 1.98.0-nightly translated into 46 million lines of C
Entirety of `rustc`, translated to C.
At a glance
- What is it?
- FractalFir's crustc is a demo of cilly, a Rust to C toolchain that lets you build a working Rust compiler with GCC and make. It is a proof of concept for targets that have a C compiler and nothing else, and it comes with the rough edges you would expect from a demo.
- Who is it for?
- crustc is for people who want to see whether a Rust toolchain can exist on a platform that only has a C compiler, and who are willing to supply their own LLVM shared library and a specific nightly toolchain. It is not for anyone who needs a supported, reproducible build of rustc for production work, and it is not a drop-in replacement for the official compiler.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 136 days ago.
- What is it written in?
- Mainly C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.
Star history
- FractalFir/crustc491 ★ · +6
| Repository | 2026-09-18 | 2026-11-13 |
|---|---|---|
| FractalFir/crustc | 485 | 491 |
6 Stars in the last 56 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What crustc actually is, and who it is for
The README describes crustc as the entirety of rustc 1.98.0-nightly (c712ea946 2026-06-16) translated into 46 million lines of C. The result is a functional Rust compiler that you build with GCC and make. That sentence is the whole pitch, and it is worth reading carefully: this is not a Rust compiler written in C, it is a Rust compiler that was emitted as C by another tool.
The repository is a demo. The README says so directly: this is a demo and teaser for a Rust to C compiler toolchain called cilly. The author notes this is the 14th attempt, after public work such as rustc_codegen_clr and a number of private ones. So the audience is narrow. You are the right reader if you maintain or care about a platform that has a C compiler but no LLVM or GCC support for Rust, or if you want to understand how far a Rust to C backend can be pushed today. You are the wrong reader if you want a supported compiler to ship in a product.
The stated goal is support for old and obscure hardware. The README frames it as an answer to the common objection that moving a project from C to Rust drops targets that only have a C toolchain. Whether that objection is fair is a separate argument; crustc is the author's attempt to remove it.
How cilly turns Rust into C, and why the output is target-specific
cilly is two things: a Rust library that generates C code, and a Rust compiler backend that plugs into rustc. The README describes the main design choice as adapting to the C compiler rather than assuming a fixed dialect.
That adaptation happens through witness programs. cilly emits small C snippets and compiles them to find out what the target toolchain supports. The README gives a one-line example: a declaration using _Thread_local, which compiles only if the C compiler supports that keyword. A second example asserts that float and double have the same size, a condition that holds on some compilers and not others. Type layouts, sizes, alignments, character encoding and integer representation are all queried rather than assumed, with fallbacks where the author could provide them.
The consequence is stated plainly: cilly output is compiler-specific. C generated for Arm64 will not run on riscv32, though you can generate C specifically for riscv32. That is a real trade-off. You gain reach into toolchains that no LLVM backend targets, and you lose the portability of the intermediate artifact. The generated C is a build product for one platform, not a portable source form you can move around.
There is also a network mode. cilly can talk to a C compiler over TCP, which the README presents as a way around the bootstrap problem on platforms without a C cross compiler. The author reports using it to compile small Rust programs for x86 Plan9 VMs while running rustc on Arm64 Linux, and shows a console transcript with a hello world binary and a symbol table entry for rust_begin_unwind.
Finally, cilly can embed markers in its object files and cache its IR, then read those markers back to split functions and globals by definition site and generate a directory of makefiles. That is how the Rust compiler in this repository ends up buildable by make in the first place.
Building the demo compiler with GCC and make
The README is explicit that this build targets ARM64 Linux because that is the author's workstation, and that it was produced on Linux with GCC 13.3.0 and Ubuntu LLD 18.1.3 as the linker. You need a path to a specific LLVM shared library, libLLVM.so.22.1-rust-1.98.0-nightly. The README says the easiest way to get one is to let rustup install the matching toolchain.
rustup install nightly-2026-06-16With that toolchain present, the build is a single make invocation with LLVM_LIB_DIR pointing at the toolchain's lib directory. The README warns against embedding prebuilt LLVM in the repository, which is why you have to supply this yourself.
make -j20 LLVM_LIB_DIR=~/.rustup/toolchains/nightly-2026-06-16-aarch64-unknown-linux-gnu/libCFLAGS are accepted, with the caveat that some flags slow compilation down.
make -j20 CFLAGS=-gThe README reports that an unoptimized build on the author's machine finishes in a few minutes, with a make -j20 time of about 1 minute 18 seconds of wall clock at 1352 percent CPU. That is the author's number on the author's hardware, and it is the only build time given. Do not read it as a promise for your machine.
To check the result, run the produced binary with the LLVM library directory and the local rustc_driver on the library path.
LD_LIBRARY_PATH=~/.rustup/toolchains/nightly-2026-06-16-aarch64-unknown-linux-gnu/lib:./rustc_driver ./rustc/rustc --versionThe expected output is the version string rustc 1.98.0-nightly (c712ea946 2026-06-16). If you get that, the compiler runs. Compiling actual programs is a further step, because the compiler needs a std to link against, and the README's own example of compiling main.rs fails with error[E0463] until std is built. The repository ships a BUILDING_STD.md file for that, and the top-level Makefile has a std target that recurses into the std directory.
The rough edges the README admits to
The README is unusually candid about where this breaks, and those admissions are the most useful part of it.
Optimizations are the first problem. The author strongly recommends not enabling them, for two reasons: they may break things, and they take time at this scale. The README describes the failure mode in concrete terms: with optimizations on, you will blitz through most code and then get stuck on some specific larger Rust files. That is a compiler that does not degrade gracefully. It is a demo that handles the bulk of an input and then stalls on the pieces that matter most for a full self-build.
The second limitation is ABI compatibility. cilly generated code is described as mostly ABI compatible with normal rustc output. The author qualifies this: on some platforms, including arm64, rustc chooses an ABI that cannot be represented from C. Mostly is doing real work in that sentence, and anyone planning to link cilly-produced objects against objects from the official rustc should treat that boundary as untested by this repository.
The third is the target lock-in already described: output is compiler-specific, so you cannot take the C generated for one architecture and run it on another. The README also notes the author tries not to assume anything outside ANSI C, including workarounds for features of modern C standards such as strict aliasing. That is a deliberate constraint that buys reach and costs code quality.
The fourth is simply scope. This repository is the compiler compiling itself, chosen because the author considers it the flashiest demonstration available. The README points to the full cilly toolchain for the general case of compiling your own Rust to C for arbitrary targets. What is published here is a showcase, not the toolchain.
Where crustc sits next to mrustc and the official rustc
The obvious comparison is mrustc, the long-running alternative Rust compiler written in C++ that bootstraps rustc from source. The difference in approach is fundamental. mrustc is an independent implementation of a Rust compiler, hand-written, that exists to break the bootstrap chain. crustc is not an independent compiler at all: it is rustc itself, mechanically translated through a Rust to C backend, with the translation done by a tool the author also wrote.
That difference decides what each is good for. mrustc's value is that it does not depend on the thing it is bootstrapping. crustc's value is that it demonstrates a general Rust to C path, and the artifact happens to be rustc. The README's own framing supports this: the point is cilly, and the compiler is the demonstration.
The other comparison is the official rustc, which is what you should use unless you specifically need a C-only build path. Official rustc has releases, a support policy, and LLVM backends for the targets most people care about. crustc has none of that. It pins a single nightly, requires a matching LLVM shared library, and produces a binary tied to the architecture it was generated for. If your target already has an official rustc, crustc is not solving a problem you have.
Maintenance, licence and the cost of upgrading
The repository is not archived, and the last push was on 2026-07-02. That is recent enough that the code is not abandoned, but the README gives no release history and no versioning scheme. The repository has no published GitHub releases, so there is no tagged artifact to pin against. You build from the default branch.
That has a direct cost. The build is pinned to rustc 1.98.0-nightly (c712ea946 2026-06-16) and to libLLVM.so.22.1-rust-1.98.0-nightly. Both the compiler source and the LLVM library are nightly artifacts. Moving to a newer nightly means regenerating the C from a newer rustc, which is a job for cilly, not for a make invocation in this repository. In practice, upgrading crustc is not a version bump; it is a re-translation.
The licence is the other open question. The repository metadata does not state a licence, and the README does not mention one. That is not a small detail for a project that is a derivative of rustc, which is distributed under dual MIT and Apache-2.0 terms, and that links against LLVM, which has its own licence. Nothing here tells you what terms apply to the generated C. If you intend to redistribute anything built from this repository, that is the first thing to resolve, and it is a question for the author or for a lawyer rather than something this article can settle.
Editorial conclusion
crustc is for people who want to see whether a Rust toolchain can exist on a platform that only has a C compiler, and who are willing to supply their own LLVM shared library and a specific nightly toolchain. It is not for anyone who needs a supported, reproducible build of rustc for production work, and it is not a drop-in replacement for the official compiler. Before adopting anything from this repository, check whether the cilly toolchain itself is published and maintained, confirm the exact LLVM version the Makefile expects, and read BUILDING_STD.md if you intend to compile real programs rather than just run --version.
Frequently asked questions
What is crustc?
It is rustc 1.98.0-nightly (c712ea946 2026-06-16) converted into 46 million lines of C, which you build with GCC and make to get a working Rust compiler. The README presents it as a demo of the cilly Rust to C toolchain rather than as a supported compiler.
How do I build crustc?
Install the matching nightly toolchain with rustup, then run make -j20 with LLVM_LIB_DIR pointing at that toolchain's lib directory, since the build needs libLLVM.so.22.1-rust-1.98.0-nightly. The README recommends against enabling optimizations because they may break the build and slow it down.
Can crustc compile my Rust programs?
The README says the produced compiler can build core, alloc and std, but compiling a program requires std to be built first; without it, compiling main.rs fails with error[E0463]. The repository includes BUILDING_STD.md and a std target in the Makefile for that step.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/fractalfir-crustc)Star history chart for your README
[](https://hysenlabs.com/projects/fractalfir-crustc)Was this useful?