Module rustc_resolve::late::lifetimes
source · Expand description
Resolution of early vs late bound lifetimes.
Name resolution for lifetimes is performed on the AST and embedded into HIR. From this information, typechecking needs to transform the lifetime parameters into bound lifetimes. Lifetimes can be early-bound or late-bound. Construction of typechecking terms needs to visit the types in HIR to identify late-bound lifetimes and assign their Debruijn indices. This file is also responsible for assigning their semantics to implicit lifetimes in trait objects.
Structs
Maps the id of each lifetime reference to the lifetime decl
that it corresponds to.
Enums
Scope 🔒
Constants
Traits
Functions
Detects late-bound lifetimes and inserts them into
late_bound
.item_for 🔒
Finds the
Item
that contains the given LocalDefId
Computes the
ResolveLifetimes
map that contains data for an entire Item
.
You should not read the result of this query directly, but rather use
named_region_map
, is_late_bound_map
, etc.Given
any
owner (structs, traits, trait methods, etc.), does lifetime resolution.
There are two important things this does.
First, we have to resolve lifetimes for
the entire Item
that contains this owner, because that’s the largest “scope”
where we can have relevant lifetimes.
Second, if we are asking for lifetimes in a trait definition, we use resolve_lifetimes_trait_definition
instead of resolve_lifetimes
, which does not descend into the trait items and does not emit diagnostics.
This allows us to avoid cycles. Importantly, if we ask for lifetimes for lifetimes that have an owner
other than the trait itself (like the trait methods or associated types), then we just use the regular
resolve_lifetimes
.Like
resolve_lifetimes
, but does not resolve lifetimes for trait items.
Also does not generate any diagnostics.Type Definitions
ScopeRef 🔒