Skip to main content

instantiate_and_unify_query_var_values

Function instantiate_and_unify_query_var_values 

Source
fn instantiate_and_unify_query_var_values<D, I>(
    delegate: &D,
    original_values: &[I::GenericArg],
    var_values: Canonicalized<I::GenericArgs>,
    instantiation: CanonicalVarValues<I>,
    span: I::Span,
)
where D: SolverDelegate<Interner = I>, I: Interner,
Expand description

Instantiate var_values as returned by the canonical query and also unify it with original_values.

This assumes that this unification will always succeed. This is the case when applying a query response right away. However, calling a canonical query, doing any other kind of trait solving, and only then instantiating the result of the query can cause the instantiation to fail. This is not supported and we ICE in this case.

We always structurally instantiate aliases. Relating aliases needs to be different depending on whether the alias is rigid or not. We’re only really able to tell whether an alias is rigid by using the trait solver. When instantiating a response from the solver we assume that the solver correctly handled aliases and therefore always relate them structurally here.