A nice interface for working with the infcx. The basic idea is to
do infcx.at(cause, param_env)
, which sets the “cause” of the
operation as well as the surrounding parameter environment. Then
you can do something like .sub(a, b)
or .eq(a, b)
to create a
subtype or equality relationship respectively. The first argument
is always the “expected” output from the POV of diagnostics.
Canonicalization is the key to constructing a query in the
middle of type inference. Ordinarily, it is not possible to store
types from type inference in query keys, because they contain
references to inference variables whose lifetimes are too short
and so forth. Canonicalizing a value T1 using canonicalize_query
produces two things:
This module handles the relationships between “free regions”, i.e., lifetime parameters.
Ordinarily, free regions are unrelated to one another, but they can be related via implied
or explicit bounds. In that case, we track the bounds using the TransitiveRelation
type,
and use that to decide when one free region outlives another, and so forth.
Freshening is the process of replacing unknown variables with fresh types. The idea is that
the type, after freshening, contains no inference variables but instead contains either a
value for each variable or fresh “arbitrary” types wherever a variable would have been.
Lexical region resolution.
Various code related to computing outlives relations.
See README.md
.
This module contains the definitions of most TypeRelation
s in the type system
(except for some relations used for diagnostics and heuristics in the compiler).
As well as the implementation of Relate
for interned things (Ty
/Const
/etc).