Skip to main content

Module lower

Module lower 

Source
Expand description

Methods for lowering the HIR to types. There are two main cases here:

  • Lowering a type reference like &usize or Option<foo::bar::Baz> to a type: The entry point for this is TyLoweringContext::lower_ty.
  • Building the type for an item: This happens through the ty query.

This usually involves resolving names, collecting generic arguments etc.

ModulesΒ§

diagnostics πŸ”’
This files contains the declaration of diagnostics kinds for ty and path lowering.
path πŸ”’
A wrapper around TyLoweringContext specifically for lowering paths.

StructsΒ§

ConstParamTypes
Wrapper struct around ArenaMap which implements [SalsaValue].
FieldType
FieldTypes
Wrapper struct around ArenaMap which implements [SalsaValue].
GenericDefaults
GenericDefaultsRef
GenericPredicates
ImplTraitLoweringState πŸ”’
MapAndCompressBoundVars πŸ”’
Given some where clause like for<'b, 'c> <Self as Trait<'a_identity>>::Gat<'b>: Bound<'c>, the mapping will map 'b back to the GAT’s 'b_identity. Then we need to compress the remaining bound var 'c to index 0.
PathDiagnosticCallbackData πŸ”’
SelfAndAssocBounds
SupertraitsInfo πŸ”’
TrackedStructToken πŸ”’
A token that is required to construct tracked structs. This exists to prevent one from accidentally creating a tracked struct outside of a query which may happen for some codepaths.
TyLoweringContext
TyLoweringResult
TyLoweringResultInfo πŸ”’
WithDefinedOpaques

EnumsΒ§

AssocTypeShorthandResolution πŸ”’
ForbidParamsAfterReason πŸ”’
GenericPredicateSource πŸ”’
ImplTrait
ImplTraitLoweringMode πŸ”’
LifetimeElisionKind
LifetimeLoweringMode
LoweringMode
TyDefId
ValueTyDefId

TraitsΒ§

TyLoweringInferVarsCtx

FunctionsΒ§

associated_type_by_name_including_super_traits_allow_ambiguity πŸ”’
callable_item_signature πŸ”’
Build the signature of a callable item (function, struct or enum variant).
const_param_ty πŸ”’
const_param_types πŸ”’
const_param_types_with_diagnostics πŸ”’
const_param_types_with_diagnostics_cycle_result πŸ”’
ctor_signature πŸ”’
field_types_query πŸ”’
field_types_with_diagnostics πŸ”’
Build the type of all specific fields of a struct or enum variant.
fn_sig_for_enum_variant_constructor πŸ”’
fn_sig_for_fn πŸ”’
fn_sig_for_struct_constructor πŸ”’
generic_defaults πŸ”’
generic_defaults_with_diagnostics πŸ”’
Resolve the default type params from generics.
generic_defaults_with_diagnostics_cycle_result πŸ”’
generic_predicates πŸ”’
Resolve the where clause(s) of an item with generics, with a given filter
generic_predicates_cycle_result πŸ”’
A cycle can occur from malformed code.
impl_self_ty_query πŸ”’
impl_self_ty_with_diagnostics πŸ”’
impl_self_ty_with_diagnostics_cycle_result πŸ”’
impl_trait_query πŸ”’
impl_trait_with_diagnostics πŸ”’
impl_trait_with_diagnostics_cycle_result πŸ”’
lower_mutability πŸ”’
param_env_from_predicates πŸ”’
push_const_arg_has_type_predicates πŸ”’
remap_gat_vars_and_recurse_into_nested_projections πŸ”’
The code below is quite involved, so let me explain.
replace_dummy_self_with_error πŸ”’
resolve_type_param_assoc_type_shorthand πŸ”’
Predicates for param_id of the form P: SomeTrait. If assoc_name is provided, only return predicates referencing traits that have an associated type of that name.
resolve_type_param_assoc_type_shorthand_cycle_result πŸ”’
trait_environment πŸ”’
ty_query πŸ”’
Build the declared type of an item. This depends on the namespace; e.g. for struct Foo(usize), we have two types: The type of the struct itself, and the constructor function (usize) -> Foo which lives in the values namespace.
type_alias_bounds πŸ”’
type_alias_bounds_with_diagnostics πŸ”’
type_alias_self_bounds πŸ”’
type_for_adt πŸ”’
type_for_const πŸ”’
type_for_const_with_diagnostics πŸ”’
Build the declared type of a const.
type_for_enum_variant_constructor πŸ”’
Build the type of a tuple enum variant constructor.
type_for_fn πŸ”’
Build the declared type of a function. This should not need to look at the function body.
type_for_static πŸ”’
type_for_static_with_diagnostics πŸ”’
Build the declared type of a static.
type_for_struct_constructor πŸ”’
Build the type of a tuple struct constructor.
type_for_type_alias_with_diagnostics πŸ”’
type_for_type_alias_with_diagnostics_cycle_result πŸ”’
value_ty πŸ”’

Type AliasesΒ§

ImplTraitIdx