How attilaadorjany/rust works
Rust is a language toolchain repository centered on compiling Rust programs, with the standard library, documentation, and developer tools alongside the compiler. The principal workflow runs from source input through syntax and type analysis, MIR processing, and backend code generation. The excerpts show inference and trait-obligation behavior; many other compiler stages and product subsystems are identified only by the tree or README, so their links are marked dashed and unverified rather than asserted as observed calls.
Main entry points: main.rs rustc driver · pass_manager.rs MIR transforms · mod.rs Type inference · ast.rs Syntax AST
Components 18
Compiler Front End
- rustc driver
compiler/rustc/src/main.rs - Syntax AST
compiler/rustc_ast/src/ast.rs - AST lowering
compiler/rustc_ast_lowering/src/lib.rs - MIR transforms
compiler/rustc_mir_transform/src/pass_manager.rs
Semantic Analysis
- Type inference
compiler/rustc_infer/src/infer/mod.rs - Trait obligations
compiler/rustc_infer/src/traits/engine.rs - Obligation fulfillment
compiler/rustc_trait_selection/src/traits/engine.rs - Compiler queries
compiler/rustc_middle/src/query/query_api.rs - Borrow checking
compiler/rustc_borrowck/src/lib.rs
Code Generation
- ABI layout
compiler/rustc_abi/src/layout.rs - LLVM codegen
compiler/rustc_codegen_llvm/src/lib.rs - Cranelift codegen
compiler/rustc_codegen_cranelift/src/lib.rs - GCC codegen
compiler/rustc_codegen_gcc/src/lib.rs
Toolchain Products
- Standard library
library/std/src - Documentation tools
src/librustdoc/lib.rs - Formatter
src/tools/rustfmt/src/bin/main.rs - Editor support
src/tools/rust-analyzer/crates/tt/src/storage.rs
Other components
- Rust developer
Connections 19
- Rust developer → rustc driver: compiles with
README.md - rustc driver → Syntax AST: parses source
- Syntax AST → AST lowering: lowers syntax
- AST lowering → Type inference: checks types
- Type inference → Trait obligations: registers goals
compiler/rustc_infer/src/traits/engine.rs - Trait obligations → Obligation fulfillment: resolves goals
compiler/rustc_trait_selection/src/traits/engine.rs - Obligation fulfillment → Type inference: uses inference
compiler/rustc_trait_selection/src/traits/engine.rs - rustc driver → Compiler queries: runs queries
- Compiler queries → MIR transforms: requests MIR passes
- MIR transforms → Borrow checking: checks borrows
- MIR transforms → ABI layout: lowers for ABI
- ABI layout → LLVM codegen: provides ABI
- rustc driver → LLVM codegen: emits native code
- rustc driver → Cranelift codegen: selects backend
- rustc driver → GCC codegen: selects backend
- Rust developer → Standard library: uses libraries
README.md - Rust developer → Documentation tools: generates docs
README.md - Rust developer → Formatter: formats code
README.md - Rust developer → Editor support: uses editor support
README.md