Function rustc_resolve::late::lifetimes::resolve_lifetimes_for
source · [−]fn resolve_lifetimes_for<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId
) -> &'tcx ResolveLifetimes
Expand description
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
.