Skip to main content

## eagerly_handle_placeholders_in_universe

# Function eagerly_handle_placeholders_in_universe

Source

    pub fn eagerly_handle_placeholders_in_universe<Infcx, I>(
        infcx: &Infcx,
        constraint: RegionConstraint<I>,
        u: UniverseIndex,
    ) -> RegionConstraint<I>where
        Infcx: InferCtxtLike<Interner = I>,
        I: Interner,

Expand description

Takes any constraints involving placeholders from the current universe and eagerly checks them. This can be done a few ways:

- There’s an assumption on the binder introducing the placeholder which means the constraint is satisfied (true)
- There’s assumptions on the binder introducing the placeholder which allow us to rewrite the constraint in terms of lower universe variables. For example given `for<'a> where('b: 'a) { prove(T: '!a_u1) }` we can convert this constraint to `T: 'b` which no longer references anything from `u1`.
- There are no relevant assumptions so we can neither rewrite the constraint nor consider it satisfied (false)
- We failed to compute the full set of assumptions when entering the binder corresponding to `u`. (ambiguity)

After handling all of the region constraints in `u` we then evaluate the entire constraint as much as possible, propagating true/false/ambiguity as close to the root of the constraint as we can. The returned constraint should be checked for whether it is true/false/ambiguous as that should affect the result of whatever operation required entering the binder corresponding to `u`.