Module wfcheck

Source

Structs§

CollectUsageSpans πŸ”’
Collect usages of the param_def_id and Res::SelfTyAlias in the HIR.
GATArgsCollector πŸ”’
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.
HasErrorDeep πŸ”’
Look for ErrorGuaranteed deeply within structs’ (unsubstituted) fields.
IsProbablyCyclical πŸ”’
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.
RedundantLifetimeArgsLint πŸ”’
WfCheckingCtxt πŸ”’

Enums§

ArbitrarySelfTypesLevel πŸ”’
The arbitrary_self_types_pointers feature implies arbitrary_self_types.
ReceiverValidityError πŸ”’
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.
UnsizedHandling πŸ”’

Functions§

augment_param_env πŸ”’
Add a new set of predicates to the caller_bounds of an existing param_env.
check_associated_item πŸ”’
check_associated_type_bounds πŸ”’
Checks all associated type defaults of trait trait_def_id.
check_dyn_incompatible_self_trait_by_name πŸ”’
Detect when a dyn-incompatible trait is referring to itself in one of its associated items.
check_fn_or_method πŸ”’
check_foreign_item πŸ”’
check_gat_where_clauses πŸ”’
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.
check_impl πŸ”’
check_impl_item πŸ”’
check_item πŸ”’
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:
check_item_fn πŸ”’
check_item_type πŸ”’
check_method_receiver πŸ”’
check_mod_type_wf πŸ”’
check_param_wf πŸ”’
check_sized_if_body πŸ”’
check_trait πŸ”’
check_trait_item πŸ”’
check_type_defn πŸ”’
In a type definition, we check that to ensure that the types of the fields are well-formed.
check_variances_for_type_defn πŸ”’
check_well_formed πŸ”’
check_where_clauses πŸ”’
Checks where-clauses and inline bounds that are declared on def_id.
confirm_type_is_not_a_method_generic_param πŸ”’
Confirms that a type is not a type parameter referring to one of the method’s type params.
could_be_self πŸ”’
enter_wf_checking_ctxt πŸ”’
gather_gat_bounds πŸ”’
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.
legacy_receiver_is_implemented πŸ”’
lint_item_shadowing_supertrait_item πŸ”’
lint_redundant_lifetimes πŸ”’
provide
receiver_is_valid πŸ”’
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>.
region_known_to_outlive πŸ”’
Given a known param_env and a set of well formed types, can we prove that region_a outlives region_b
report_bivariance πŸ”’
test_region_obligations πŸ”’
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
ty_known_to_outlive πŸ”’
Given a known param_env and a set of well formed types, can we prove that ty outlives region.