[][src]Module rustc_typeck::collect

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

"Collection" is the process of determining the type and other external details of each item in Rust. Collection is specifically concerned with inter-procedural things -- for example, for a function definition, collection will figure out the type and signature of the function, but it will not visit the body of the function in any way, nor examine type annotations on local variables (that's the job of type checking).

Collecting is ultimately defined by a bundle of queries that inquire after various facts about the items in the crate (e.g., type_of, generics_of, predicates_of, etc). See the provide function for the full set.

At present, however, we do run collection across all items in the crate as a kind of pass. This should eventually be factored away.

Structs

CollectItemTypesVisitorInternal
ItemCtxtInternal

Context specific to some particular item. This is what implements AstConv. It has information about the predicates that are defined on the trait. Unfortunately, this predicate information is available in various different forms at various points in the process. So we can't just store a pointer to e.g., the AST or the parsed ty form, we have to be more flexible. To this end, the ItemCtxt is parameterized by a DefId that it uses to satisfy get_type_parameter_bounds requests, drawing the information from the AST (hir::Generics), recursively.

OnlySelfBoundsInternal

Functions

adt_defInternal
bad_placeholder_typeInternal
checked_type_ofInternal

Same as type_of but returns Option instead of failing.

codegen_fn_attrsInternal
collect_mod_item_typesInternal
compute_sig_of_foreign_fn_declInternal
convert_enum_variant_typesInternal
convert_impl_itemInternal
convert_itemInternal
convert_trait_itemInternal
convert_variantInternal
convert_variant_ctorInternal
early_bound_lifetimes_from_genericsInternal

Returns the early-bound lifetimes declared in this generics listing. For anything other than fns/methods, this is just all the lifetimes that are declared. For fns or methods, we have to screen out those that do not appear in any where-clauses etc using resolve_lifetime::early_bound_lifetimes.

explicit_predicates_ofInternal

Returns a list of user-specified type predicates for the definition with ID def_id. N.B., this does not include any implied/inferred constraints.

find_existential_constraintsInternal
fn_sigInternal
from_target_featureInternal
generics_ofInternal
get_infer_ret_tyInternal
has_late_bound_regionsInternal
impl_polarityInternal
impl_trait_refInternal
is_foreign_itemInternal
is_paramInternal

Tests whether this is the AST for a reference to the type parameter with ID param_id. We use this so as to avoid running ast_ty_to_ty, because we want to avoid triggering an all-out conversion of the type to avoid inducing unnecessary cycles.

linkage_by_nameInternal
predicates_defined_onInternal

Returns a list of type predicates for the definition with ID def_id, including inferred lifetime constraints. This includes all predicates returned by explicit_predicates_of, plus inferred constraints concerning which regions outlive other regions.

predicates_from_boundInternal

Converts a specific GenericBound from the AST into a set of predicates that apply to the self type. A vector is returned because this can be anywhere from zero predicates (T: ?Sized adds no predicates) to one (T: Foo) to many (T: Bar<X=i32> adds T: Bar and <T as Bar>::X == i32).

predicates_ofInternal

Returns a list of all type predicates (explicit and implicit) for the definition with ID def_id. This includes all predicates returned by predicates_defined_on, plus Self: Trait predicates for traits.

provideInternal
report_assoc_ty_on_inherent_implInternal
static_mutabilityInternal
super_predicates_ofInternal

Ensures that the super-predicates of the trait with a DefId of trait_def_id are converted and stored. This also ensures that the transitive super-predicates are converted.

trait_defInternal
type_ofInternal
type_param_predicatesInternal