Rust monomorphization and trait dispatch

R-MONO-V4-2medium

Instantiate what instances call

This authored build-demand planner is not a compiler/linker or a code-size measurement. Commands are one per line: call <fn> <type>, uses <fn> <callee> in Medium/Hard, plan, and plan shared in Hard. Function/base-type names match [A-Za-z_][A-Za-z0-9_]*; a type token is a base name optionally prefixed by one * or &, and ptr is reserved for the shared-body marker. These are opaque planner categories, not native Go/Rust/C++ type syntax: &str here shares under the model rule, without claiming that a real Rust string-slice reference is a thin pointer. All uses edges forward the exact same type token. Edges/calls accumulate in input order; duplicate edges and cycles are allowed; every plan recomputes a fresh report over everything declared so far. Depth-first first-demand order is part of the report contract. At most 32 distinct functions, 16 base types, 128 calls, 128 edges, 16 plans and 256 ASCII command lines, each at most 8192 bytes; ordinary I/O/allocation completes. Bare plan keeps exact pairs; shared groups * and & tokens per function while retaining every exact function/type dictionary demand. The model does not include real compiler type substitution, GC maps, method-set analysis, wrappers, optimization or machine-code emission.

What needs to change

Change instantiate so a plan includes everything its instances need.

Reproduce

  1. Run the sample: the C++ program reads sort uses compare and a call to sort with i32, then plan. Compare the line.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

record and nameFor are supplied. plan.uses points to the callee map; plan.visited is a std::set. The lab compiles with g++ -std=c++23.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in