[Tracking] Compiler refactoring plan, August 2026: execute the seven phases
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 14
- Forks
- 2
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 61
Description
The plan landed in 3a5f0912 as docs/discussions/compiler_refactoring_plan_2026_08.md.
This issue tracks executing it. One issue per phase would fragment the dependency
order, so phases get checked off here and each commit references this number.
The plan's own framing: a new language feature costs two implementations today
(AST codegen and flat codegen, plus TypeChecker and flatten.rs on the front),
and the second one is invisible until a corpus number moves.
Phases
- 0 — Clear the floor. Dead code, the codegen/pipeline cycle, two layer
inversions, CI gates. Very low risk, blocks 5 and 6. - 1 — Name the decline.
Option<T>toResult<T, Decline>at the 72 +
96 bail-out sites, so flat coverage is a query instead of a filename list.
Blocks 4. - 2 — One type identity. Stop round-tripping type identity through
formatted strings. Blocks 4. - 3 — Split the god objects.
TypeChecker(43 fields),
emit_function_mlir(1,413 lines),check_transfer_expr(750 lines). - 4 — One backend. The payoff. Needs 1-3.
- 5 — One orchestrator. Fixes the class of bug hiraditya/Vx.1#386 was an instance of.
- 6 — Workspace split. Cycle-cutting landed early (25711c73, 32be1f10); what
remains is a Cargo.toml exercise plus the corrected crate list. - 7 — Runtime C++. Independent of everything else.
Corrections to the plan as written
Two Phase 0 items do not survive checking against the tree:
Item 5 (scratch artifacts in the repo root) is already handled. git ls-files
returns nothing matching, and .gitignore lines 10-14 already cover *.o, *.log,
*.ll, *.mlir. The 20 files sitting in the root are untracked local clutter, so
moving them changes nothing for anyone else. The real item, if we want one, is that
tests and scripts write scratch output to the CWD instead of a temp dir -- a
different and smaller problem than the one the plan describes.
Item 3 lists six types; only three are imports. diagnostics_json.rs:16 imports
ResidentSet, SpawnRegionTraffic, and StagingRoute. SpaceTraffic, Traffic,
and CostSource are reached through full crate::hir::env:: paths, several of them
only in tests. The inversion is real either way, but it is three types wide, not six.
The rest of Phase 0 checks out: nothing outside hir/arena.rs and hir/lower_ast.rs
mentions HirArena, HirExpr, or HirStmt; src/test_parent.rs is declared by no
mod statement at all; codegen/flat.rs reaches crate::pipeline::Schedule at 11
sites while pipeline imports codegen; syntax/macro_expand.rs constructs
crate::parser::Parser at 3 sites; and CI has no clippy step and no debug-profile
run, so #[cfg(debug_assertions)] code -- including the whole
parallel_architecture_verifier -- never executes there.
Invariants
Every phase lands behind the gates the plan lists: byte-identical MLIR across
thread counts, compilation isolation, parity with the AST oracle, flat coverage
does not shrink, determinism at 16,000 functions, and the two no-locks grep gates.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/discussions/compiler_refactoring_plan_2026_08.md, then read this tracking issue's phase dependencies and invariants. Choose a separately scoped phase or task only after confirming its entry points and gates; completion requires the relevant phase checklist item and all listed invariants to pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100