main
md 23 lines 1.06 KB
Rendered Raw
1 ---
2 description: Conventions for Rust port code in compiler/crates
3 globs:
4 - compiler/crates/**/*.rs
5 - compiler/crates/**/Cargo.toml
6 ---
7
8 When working on Rust code in `compiler/crates/`:
9
10 - Follow patterns from `compiler/docs/rust-port/rust-port-architecture.md`
11 - Use arenas + copyable IDs instead of shared references: `IdentifierId`, `ScopeId`, `FunctionId`, `TypeId`
12 - Pass `env: &mut Environment` separately from `func: &mut HirFunction`
13 - Use two-phase collect/apply when you can't mutate through stored references
14 - Run `bash compiler/scripts/test-babel-ast.sh` to test AST round-tripping
15 - Use `/port-pass <name>` when porting a new compiler pass
16 - Use `/compiler-verify` before committing to run both Rust and TS tests
17 - Keep Rust code structurally close to the TypeScript (~85-95% correspondence)
18
19 Before declaring work complete on a plan doc:
20 - Re-read the original user prompt to ensure all requested steps are done
21 - Check the plan doc for any "Remaining Work" items
22 - Verify test-babel-ast.sh passes with the expected fixture count
23 - Update the plan doc's status section