Module rustc_typeck::check::wfcheck
source · [−]Structs
AdtField 🔒
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
.Constants
Functions
Add a new set of predicates to the caller_bounds of an existing param_env.
Checks all associated type defaults of trait
trait_def_id
.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 substs. 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:
Detect when an object unsafe trait is referring to itself in one of its associated items.
When this is done, suggest using
Self
instead.Basically
check_associated_type_bounds
, but separated for now and should be
deduplicated when RPITITs get lowered into real associated items.In a type definition, we check that to ensure that the types of the fields are well-formed.
Checks where-clauses and inline bounds that are declared on
def_id
.e0307 🔒
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 the feature is not 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, can we prove that
region_a
outlives region_b
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 errorsGiven a known
param_env
and a set of well formed types, can we prove that
ty
outlives region
.