Expand description
Support inheriting generic parameters and predicates for function delegation.
For more information about delegation design, see the tracking issue #118212.
Structsยง
- Param
Index ๐Remapper
Enumsยง
- FnKind ๐
- Inheritance
Kind ๐ - Given the current context(caller and callee
FnKind), it specifies the policy of predicates and generic parameters inheritance. - Self
Position ๐Kind
Functionsยง
- adjust_
sig_ ๐in_ inherent_ impl_ cases - We need to replace
Selftype of the signature function parent with either type of parent of delegation (which is eitherSelfparam in case of trait) and other ADT in case of inherent impl. We do the same thing when delegating to trait, in this case replacement happens during signature instantiation (as we can replaceSelfgeneric param with other type fromargswhen instantiating). - check_
constraints ๐ - create_
folder_ ๐and_ args - create_
generic_ ๐args - Creates generic arguments for further delegation signature and predicates instantiation.
Arguments can be user-specified (in this case they are in
parent_argsandchild_args) or propagated. User can specify either bothparent_argsandchild_args, one of them or none, that is why we firstly create generic arguments from generic params and then adjust them with user-specified args. - create_
mapping ๐ - Maps sig generics into generic args of delegation. Delegation generics has the following pattern:
- create_
self_ ๐param_ position_ kind - delegation_
user_ ๐specified_ args - fn_kind ๐
- fn_
kinds ๐ - get_
delegation_ ๐parent_ args_ count_ without_ self - get_
delegation_ ๐self_ ty - get_
parent_ ๐and_ inheritance_ kind - inherit_
clauses_ ๐for_ delegation_ item - inherit_
sig_ ๐for_ delegation_ item
Type Aliasesยง
- Remap
Table ๐