Repository navigation
Open
Labels
Description
Part of #9. Phase 1 — level 1.
Learning goals
Rust's data-and-behavior split as an analysis subject (struct vs impl vs trait — you are now
modeling the thing TRPL taught you), collections at scale (TRPL Common Collections), interior
organization of a large module, two-pass algorithms over owned data.
Task
Extend the builder to the full node-kind set, one build_* method each:
- structs / enums-with-data / unions — fields with types + visibility, variant payloads,
derives + attributes intodecorators, generics + lifetimes + where-clauses. - traits — required + default methods (default methods are callables WITH bodies — they get
call sites), supertraits intobase_classes. - impl blocks — the crux.
impl Point { ... }andimpl Display for Point { ... }attach
methods to the TYPE's entry; trait impls also recordTraitinto the type'sbase_classes
and use the<Type as Trait>::method(...)signature form. - modules (
mod foo { ... }inline and file-based) shape the signature path;useimports
intoimports[](you need them for issue 06's resolution map). - module-level
static/constintovariables[]; macros per your issue-02 stance.
This requires the two-pass build. An impl block may live in a different file from its type
(the exact cross-file trap the skill calls out for Go — Rust has it via sibling-file impls):
pass 1 indexes every type declaration (crate, path) -> owning module; pass 2 attaches methods
through that index. Single-pass builders silently drop every sibling-file method.
Teacher's notes
- Grow the fixture NOW: a struct in
shapes.rs, itsimplinshapes_impl.rs, a trait with a
default method, an enum with data variants, apuband a private item. - Ask of every new field: will a consumer branch on it? → typed field. Descriptive only? → tags.
(references/schema-reference.md§ expansion rubric.)
Gate (full symbol-table gate)
- Cross-file attachment test: the sibling-file impl's methods appear under the struct — the
single highest-value test of this issue. - Every Rust-specific field asserted by VALUE at least once (enum variant payload, trait default
method's call sites, supertrait in base_classes, derive in decorators, pub vs private). - Re-run reuses cache for unchanged files (mtime unchanged on second lazy run).
Activity