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 into decorators, generics + lifetimes + where-clauses. - traits — required + default methods (default methods are callables WITH bodies — they get
call sites), supertraits into base_classes. - impl blocks — the crux.
impl Point { ... } and impl Display for Point { ... } attach
methods to the TYPE's entry; trait impls also record Trait into the type's base_classes
and use the <Type as Trait>::method(...) signature form. - modules (
mod foo { ... } inline and file-based) shape the signature path; use imports
into imports[] (you need them for issue 06's resolution map). - module-level
static/const into variables[]; 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, its impl in shapes_impl.rs, a trait with a
default method, an enum with data variants, a pub and 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).
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:derives + attributes into
decorators, generics + lifetimes + where-clauses.call sites), supertraits into
base_classes.impl Point { ... }andimpl Display for Point { ... }attachmethods to the TYPE's entry; trait impls also record
Traitinto the type'sbase_classesand use the
<Type as Trait>::method(...)signature form.mod foo { ... }inline and file-based) shape the signature path;useimportsinto
imports[](you need them for issue 06's resolution map).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 methodsthrough that index. Single-pass builders silently drop every sibling-file method.
Teacher's notes
shapes.rs, itsimplinshapes_impl.rs, a trait with adefault method, an enum with data variants, a
puband a private item.(
references/schema-reference.md§ expansion rubric.)Gate (full symbol-table gate)
single highest-value test of this issue.
method's call sites, supertrait in base_classes, derive in decorators, pub vs private).