You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support generic struct and proto methods through monomorphization #435
enhancementA request for a new feature or improvement.feature requestA request for a new feature or functionality.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.
The generic rewriting pass currently rejects methods with generic parameters inside structs and proto implementations. This leaves an intentional frontend gap even when the surrounding type can already be monomorphized.
Define and implement generic method instantiation for struct methods and proto implementation methods. Method-level type parameters must coexist predictably with receiver or enclosing-type parameters.
Acceptance criteria
Generic struct methods can be declared and called.
Generic proto implementation methods follow the same substitution rules.
Enclosing and method-level type parameters cannot collide silently.
Call-site inference and explicit generic arguments have documented behavior.
Equivalent instantiations are deduplicated.
Recursive or cyclic instantiation produces a diagnostic instead of unbounded rewriting.
Typed HIR retains fully resolved method signatures.
Positive and negative frontend fixtures cover nested generic types, ambiguity, and constraint failures.
Verified against canonical master 509a1e4 and reran the existing coverage while preparing #701. front/parser/src/methods.rs describes explicit arguments, inference and enclosing-type substitution. All six generic_methods tests and generic_methods_and_nested_method_receivers_execute_once pass, covering struct/proto methods, deduplication, collisions, invalid arguments, bounded recursion and nested receivers. The implementation already satisfies this issue.
enhancementA request for a new feature or improvement.feature requestA request for a new feature or functionality.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.
Activity
LunaStev commentedon Sep 23, 2026
Verified against canonical master 509a1e4 and reran the existing coverage while preparing #701.
front/parser/src/methods.rsdescribes explicit arguments, inference and enclosing-type substitution. All sixgeneric_methodstests andgeneric_methods_and_nested_method_receivers_execute_oncepass, covering struct/proto methods, deduplication, collisions, invalid arguments, bounded recursion and nested receivers. The implementation already satisfies this issue.