Expand description
Methods for lowering the HIR to types. There are two main cases here:
- Lowering a type reference like
&usizeorOption<foo::bar::Baz>to a type: The entry point for this isTyLoweringContext::lower_ty. - Building the type for an item: This happens through the
tyquery.
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
TyLoweringContextspecifically for lowering paths.
StructsΒ§
- Const
Param Types - Wrapper struct around
ArenaMapwhich implements [SalsaValue]. - Field
Type - Field
Types - Wrapper struct around
ArenaMapwhich implements [SalsaValue]. - Generic
Defaults - Generic
Defaults Ref - Generic
Predicates - Impl
Trait πLowering State - MapAnd
Compress πBound Vars - Given some where clause like
for<'b, 'c> <Self as Trait<'a_identity>>::Gat<'b>: Bound<'c>, the mapping will map'bback to the GATβs'b_identity. Then we need to compress the remaining bound var'cto index 0. - Path
Diagnostic πCallback Data - Self
AndAssoc Bounds - Supertraits
Info π - Tracked
Struct πToken - 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.
- TyLowering
Context - TyLowering
Result - TyLowering
Result πInfo - With
Defined Opaques
EnumsΒ§
- Assoc
Type πShorthand Resolution - Forbid
Params πAfter Reason - Generic
Predicate πSource - Impl
Trait - Impl
Trait πLowering Mode - Lifetime
Elision Kind - Lifetime
Lowering Mode - Lowering
Mode - TyDefId
- Value
TyDef Id
TraitsΒ§
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_idof the formP: SomeTrait. Ifassoc_nameis 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) -> Foowhich 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 π