S0123: cannot infer type arguments for type
Generated from rellum-diagnostics/src/db.rs.
Explanation
Generic record and enum construction can infer type arguments only from fields whose declared types mention the parameters. If a parameter never appears in the provided field information, the compiler needs an explicit type annotation.
Common causes
- constructing a generic record or enum without enough fields to infer every type parameter
- using a generic parameter only in fields that are omitted or unknown
- expecting return-context inference where only constructor fields are used
Canonical fixes
- add an explicit type annotation with concrete arguments
Before:
value = Box { value: none }
After:
value: Box[Int] = Box { value: none }
- provide fields whose types determine every generic parameter
Code example
value = Box { value: none }