Skip to main content

Module delegation

Module delegation 

Source
Expand description

Support inheriting generic parameters and predicates for function delegation.

For more information about delegation design, see the tracking issue #118212.

Structsยง

ParamIndexRemapper ๐Ÿ”’

Enumsยง

FnKind ๐Ÿ”’
InheritanceKind ๐Ÿ”’
Given the current context(caller and callee FnKind), it specifies the policy of predicates and generic parameters inheritance.
SelfPositionKind ๐Ÿ”’

Functionsยง

adjust_sig_in_inherent_impl_cases ๐Ÿ”’
We need to replace Self type of the signature function parent with either type of parent of delegation (which is either Self param 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 replace Self generic param with other type from args when 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_args and child_args) or propagated. User can specify either both parent_args and child_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ยง

RemapTable ๐Ÿ”’