TypeVisitor that looks for uses of GATs like
<P0 as Trait<P1..Pn>>::GAT<Pn..Pm> and adds the arguments P0..Pm into
the two vectors, regions and types (depending on their kind). For each
parameter Pi also track the index i.
Detects cases where an ADT/LTA is trivially cyclical β we want to detect this so
we only mention that its parameters are used cyclically if the ADT/LTA is truly
cyclical.
Error cases which may be returned from receiver_is_valid. These error
cases are generated in this function as they may be unearthed as we explore
the autoderef chain, but theyβre converted to diagnostics in the caller.
Require that the user writes where clauses on GATs for the implicit
outlives bounds involving trait parameters in trait functions and
lifetimes passed as GAT args. See self-outlives-lint test.
Checks that the field types (in a struct defβn) or argument types (in an enum defβn) are
well-formed, meaning that they do not require any constraints not declared in the struct
definition itself. For example, this definition would be illegal:
We use the following trait as an example throughout this function.
Specifically, letβs assume that to_check here is the return type
of into_iter, and the GAT we are checking this for is Iter.
Returns whether receiver_ty would be considered a valid receiver type for self_ty. If
arbitrary_self_types is enabled, receiver_ty must transitively deref to self_ty, possibly
through a *const/mut T raw pointer if arbitrary_self_types_pointers is also enabled.
If neither feature is enabled, the requirements are more strict: receiver_ty must implement
Receiver and directly implement Deref<Target = self_ty>.
Given a known param_env and a set of well formed types, set up an
InferCtxt, call the passed function (to e.g. set up region constraints
to be tested), then resolve region and return errors