# thatkj/rust architecture

> Architecture diagram of the GitHub repository thatkj/rust, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thatkj/rust
- Repository: https://github.com/thatkj/rust

## Overview

This repository is Rust’s source tree: it includes the compiler, standard library, documentation, and tooling. The sampled compiler sources illuminate inference and trait-obligation handling, plus MIR pass management; they do not expose enough of rustc’s entry-point wiring to reconstruct a full user-to-binary pipeline. The graph therefore emphasizes evidenced internal relationships and preserves documented product areas without guessing their connections. Several broad capabilities are represented by their enclosing source directories because their implementations were not sampled.

Main entry points: [`compiler/rustc_infer/src/infer/mod.rs`](https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/infer/mod.rs) (Inference context), [`compiler/rustc_mir_transform/src/pass_manager.rs`](https://github.com/thatkj/rust/blob/main/compiler/rustc_mir_transform/src/pass_manager.rs) (MIR passes), [`compiler/rustc_infer/src/traits/engine.rs`](https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/traits/engine.rs) (Obligation engine), [`compiler/rustc_trait_selection/src/traits/engine.rs`](https://github.com/thatkj/rust/blob/main/compiler/rustc_trait_selection/src/traits/engine.rs) (Trait selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_compiler["Compiler core"]
  node_rustc["rustc entry<br/>[main.rs]"]
  node_query["Query execution<br/>[execution.rs]"]
  node_mir["MIR passes<br/>[pass_manager.rs]"]
  node_mirvalidate["MIR validation<br/>[validate.rs]"]
end

subgraph group_semantic["Type semantics"]
  node_infer["Inference context<br/>[mod.rs]"]
  node_inferengine["Obligation engine<br/>[engine.rs]"]
  node_traitengine["Trait selection<br/>[engine.rs]"]
end

subgraph group_product["Rust products"]
  node_stdlib["Standard library"]
  node_rustdoc["Documentation tooling"]
  node_rustfmt["Formatter"]
  node_clippy["Linter"]
  node_analyzer["Editor support"]
  node_cargo["Package tooling"]
end

node_developer(("Rust developer"))

node_mir -->|"runs validation"| node_mirvalidate
node_inferengine -->|"uses context"| node_infer
node_traitengine -->|"registers obligations"| node_infer
node_developer -.->|"compiles with"| node_rustc
node_developer -.->|"uses"| node_stdlib
node_developer -.->|"generates docs"| node_rustdoc
node_developer -.->|"formats with"| node_rustfmt
node_developer -.->|"lints with"| node_clippy
node_developer -.->|"gets editor support"| node_analyzer
node_developer -.->|"builds with"| node_cargo

click node_rustc "https://github.com/thatkj/rust/blob/main/compiler/rustc/src/main.rs"
click node_query "https://github.com/thatkj/rust/blob/main/compiler/rustc_query_impl/src/execution.rs"
click node_mir "https://github.com/thatkj/rust/blob/main/compiler/rustc_mir_transform/src/pass_manager.rs"
click node_mirvalidate "https://github.com/thatkj/rust/blob/main/compiler/rustc_mir_transform/src/validate.rs"
click node_infer "https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/infer/mod.rs"
click node_inferengine "https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/traits/engine.rs"
click node_traitengine "https://github.com/thatkj/rust/blob/main/compiler/rustc_trait_selection/src/traits/engine.rs"
click node_stdlib "https://github.com/thatkj/rust/tree/main/library/std"
click node_rustdoc "https://github.com/thatkj/rust/tree/main/src/librustdoc"
click node_rustfmt "https://github.com/thatkj/rust/tree/main/src/tools/rustfmt"
click node_clippy "https://github.com/thatkj/rust/tree/main/src/tools/clippy"
click node_analyzer "https://github.com/thatkj/rust/tree/main/src/tools/rust-analyzer"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rustc,node_query,node_mir,node_mirvalidate toneBlue
class node_infer,node_inferengine,node_traitengine toneAmber
class node_stdlib,node_rustdoc,node_rustfmt,node_clippy,node_analyzer,node_cargo toneMint
class node_developer toneIndigo
```

## Components

### Compiler core

- [rustc entry](https://github.com/thatkj/rust/blob/main/compiler/rustc/src/main.rs): `compiler/rustc/src/main.rs`
- [Query execution](https://github.com/thatkj/rust/blob/main/compiler/rustc_query_impl/src/execution.rs): `compiler/rustc_query_impl/src/execution.rs`
- [MIR passes](https://github.com/thatkj/rust/blob/main/compiler/rustc_mir_transform/src/pass_manager.rs): `compiler/rustc_mir_transform/src/pass_manager.rs`
- [MIR validation](https://github.com/thatkj/rust/blob/main/compiler/rustc_mir_transform/src/validate.rs): `compiler/rustc_mir_transform/src/validate.rs`

### Type semantics

- [Inference context](https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/infer/mod.rs): `compiler/rustc_infer/src/infer/mod.rs`
- [Obligation engine](https://github.com/thatkj/rust/blob/main/compiler/rustc_infer/src/traits/engine.rs): `compiler/rustc_infer/src/traits/engine.rs`
- [Trait selection](https://github.com/thatkj/rust/blob/main/compiler/rustc_trait_selection/src/traits/engine.rs): `compiler/rustc_trait_selection/src/traits/engine.rs`

### Rust products

- [Standard library](https://github.com/thatkj/rust/tree/main/library/std): `library/std`
- [Documentation tooling](https://github.com/thatkj/rust/tree/main/src/librustdoc): `src/librustdoc`
- [Formatter](https://github.com/thatkj/rust/tree/main/src/tools/rustfmt): `src/tools/rustfmt`
- [Linter](https://github.com/thatkj/rust/tree/main/src/tools/clippy): `src/tools/clippy`
- [Editor support](https://github.com/thatkj/rust/tree/main/src/tools/rust-analyzer): `src/tools/rust-analyzer`
- **Package tooling**

### Other components

- **Rust developer**

## Connections

- MIR passes → MIR validation: runs validation (evidence: `compiler/rustc_mir_transform/src/pass_manager.rs`)
- Obligation engine → Inference context: uses context (evidence: `compiler/rustc_infer/src/traits/engine.rs`)
- Trait selection → Inference context: registers obligations (evidence: `compiler/rustc_trait_selection/src/traits/engine.rs`)
- Rust developer → rustc entry: compiles with (evidence: `README.md`)
- Rust developer → Standard library: uses (evidence: `README.md`)
- Rust developer → Documentation tooling: generates docs (evidence: `README.md`)
- Rust developer → Formatter: formats with (evidence: `README.md`)
- Rust developer → Linter: lints with (evidence: `README.md`)
- Rust developer → Editor support: gets editor support (evidence: `README.md`)
- Rust developer → Package tooling: builds with (evidence: `README.md`)
