What problem does it solve?
Provides concrete design guidance for compiler data structures to avoid lifetime complexity, invalid indices, and fragile references when managing arenas and interlinked collections.
Core Features & Use Cases
- Prefer storing typed indices instead of direct references to avoid Rust lifetime issues and enable mutation without borrow conflicts.
- Use Span for contiguous child ranges that point into a shared arena to keep parent structs compact and often Copy.
- Never manually construct indices; obtain them from collection operations such as push, enumerate_idx, or iter_idx to guarantee validity.
- Anti-patterns to avoid: using plain Vec when elements are referenced by index, mixing raw usize across collections, storing &T references for long-term linking, and constructing indices by hand.
- Libraries and patterns: use newtype_index to declare compact typed indices, plank_core IndexVec for index-typed collections, Span for range semantics, and DenseIndexSet for bitset membership operations.
Quick Start
When adding a new AST node, define a typed index with newtype_index, store instances in plank_core IndexVec, and reference child ranges using Span instead of per-parent Vecs.