Module opaque_types

Source

Structs§

ConstrainOpaqueTypeRegionVisitor 🔒
Visitor that requires that (almost) all regions in the type visited outlive least_region. We cannot use push_outlives_components because regions in closure signatures are not included in their outlives components. We need to ensure all regions outlive the given bound so that we don’t end up with, say, ReVar appearing in a return type and causing ICEs when other functions end up with region constraints involving regions from other functions.

Functions§

register_member_constraints 🔒
Given the map opaque_types containing the opaque impl Trait types whose underlying, hidden types are being inferred, this method adds constraints to the regions appearing in those underlying hidden types to ensure that they at least do not refer to random scopes within the current function. These constraints are not (quite) sufficient to guarantee that the regions are actually legal values; that final condition is imposed after region inference is done.
take_opaques_and_register_member_constraints 🔒
Once we’re done with typechecking the body, we take all the opaque types defined by this function and add their ‘member constraints’.