rust-lang/rust
By the numbers
Data collected on 2026-04-30 from commit f53b654a888 (default branch main).
A quantitative snapshot of the codebase. For qualitative architecture see Architecture; for history see Lore.
Size
The repository is dominated by the test suite and the compiler crates:
| Area | Rust source files | Notes |
|---|---|---|
tests/ |
~25,400 | UI, codegen, MIR, incremental, run-make, rustdoc, debuginfo, … |
src/tools/ |
~7,100 | rustdoc, miri, clippy, rustfmt, rust-analyzer, tidy, compiletest, … |
compiler/ |
~2,100 | ~70 rustc_* crates |
library/ |
~2,000 | std, core, alloc, proc_macro, test, plus stdarch / portable-simd subtrees |
xychart-beta
title "Rust source files by area"
x-axis ["tests", "src/tools", "compiler", "library"]
y-axis "Files" 0 --> 30000
bar [25400, 7100, 2100, 2000]A few size landmarks:
compiler/rustc_driver_impl/src/lib.rs— ~65 KB (the driver entry, command-line dispatch, and most of the top-level orchestration)bootstrap.example.toml— ~50 KB of documented build optionsRELEASES.md— ~895 KB of release notes going back to 1.0src/bootstrap/bootstrap.py— ~54 KB pre-rustc Python runnertriagebot.toml— ~53 KB of automation rules (assignments, ping groups, mentions)Cargo.lock— ~150 KB workspace lock
Activity
Commit volume on the default branch:
| Window | Commits |
|---|---|
| Total (since project start) | hundreds of thousands |
| Since 2024-01-01 | ~76,600 |
| Since 2025-04-01 | ~34,100 |
| Last week | hundreds |
(Counts include merge commits from the bors queue, which inflate "commits" relative to "PRs".)
The repository is in continuous flux: at any given moment there are typically dozens of PRs in the merge queue, hundreds open, and several rolling release branches.
Churn hotspots
Areas that change most frequently (over the last several months, by file edit count):
| Area | Reason |
|---|---|
compiler/rustc_middle/src/ty/ |
Type system core; touched by nearly every type system change |
compiler/rustc_borrowck/src/ |
Active development on diagnostics + Polonius |
compiler/rustc_hir_typeck/src/ |
Hot path for type-inference fixes |
compiler/rustc_trait_selection/src/ |
Trait solver evolution |
library/std/src/ |
Standard library API additions and bugfixes |
tests/ui/ |
New tests added with most language-affecting PRs |
Bot-attributed commits
The rust-lang/rust repository is heavily automated:
- Most commits on
mainare bors merge commits authored bybors@rust-lang.org. The actual change author appears in the commit body, not the author field. - Other automation accounts that show up in history:
triagebot[bot]— assignments, label maintenancerenovate[bot]— npm/JS dep bumps for tooling (configured in.github/renovate.json5)dependabot[bot]— security advisories on tooling depsgithub-actions[bot]— release-train rollups, generated artifacts
Inline AI-assisted authoring (Copilot, Cursor, etc.) is not visible in git history; this section is a lower bound on automation in commits.
Complexity
The compiler is the most complex area. A few signals:
rustc_middle— the architectural hub. Re-exports almost every important type and is imported by most otherrustc_*crates.rustc_driver_impl— the largest crate by entry-file size; orchestrates compilation phases and command-line modes.rustc_codegen_llvm+rustc_codegen_ssa— the LLVM backend; ~5,000 lines of Rust calling into FFI bindings underrustc_llvm(which itself wraps the in-tree LLVM atsrc/llvm-project/).rustc_borrowck+rustc_mir_dataflow— the borrow checker and the dataflow framework it builds on.rustc_trait_selection— the canonical trait solver; being progressively replaced byrustc_next_trait_solver(the "new solver" feature gated under-Znext-solver).
Standard library complexity hotspots:
library/core—iter,slice,num,intrinsics,strare the heaviest moduleslibrary/std— platform-conditional code understd/src/sys/is the largest single arealibrary/stdarch— generated SIMD intrinsics across many architectures (vendored as a subtree)
Dependencies
The workspace Cargo.toml lists ~45 published members. External crates.io dependencies are kept deliberately small in compiler/ and library/:
library/uses essentially zero external dependencies (only the in-tree runtime crates andcompiler-builtins)compiler/uses a curated set:tracing,bitflags,serde,thin-vec,smallvec,parking_lot,regex(in selected places), and FFI bindings (rustc_llvm,tikv-jemalloc-sys)- New crates.io dependencies require team review and an entry in
src/tools/tidy/src/extdeps.rs(allow-list)
Test coverage
The tests/ directory is the ground truth for compiler correctness:
| Suite | Approx. test count | Purpose |
|---|---|---|
ui/ |
14,000+ | Compiler diagnostics and successful compilation |
run-make/ |
400+ | Cargo-/rustc-driven end-to-end builds |
incremental/ |
200+ | Caching correctness across edits |
mir-opt/ |
600+ | MIR pass output snapshots |
codegen-llvm/ |
1,000+ | Specific LLVM IR / asm patterns |
assembly-llvm/ |
dozens | Final assembly output |
debuginfo/ |
dozens | LLDB / GDB / CDB debugger interaction |
rustdoc-html/ |
hundreds | HTML output of rustdoc |
rustdoc-json/ |
dozens | JSON output of rustdoc |
crashes/ |
hundreds | Known-bad inputs that previously ICE'd |
The tests/crashes/ suite is unusual: it contains files that should currently trigger an ICE — once they no longer do, they get moved to tests/ui/ with a regression label.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.