rustc_trait_selection::traits::wf

Function object_region_bounds

Source
pub fn object_region_bounds<'tcx>(
    tcx: TyCtxt<'tcx>,
    existential_predicates: &'tcx List<PolyExistentialPredicate<'tcx>>,
) -> Vec<Region<'tcx>>
Expand description

Given an object type like SomeTrait + Send, computes the lifetime bounds that must hold on the elided self type. These are derived from the declarations of SomeTrait, Send, and friends – if they declare trait SomeTrait : 'static, for example, then 'static would appear in the list.

N.B., in some cases, particularly around higher-ranked bounds, this function returns a kind of conservative approximation. That is, all regions returned by this function are definitely required, but there may be other region bounds that are not returned, as well as requirements like for<'a> T: 'a.

Requires that trait definitions have been processed so that we can elaborate predicates and walk supertraits.