fn merge_into_guidance(
    root_goal: &Canonical<InEnvironment<Goal>>,
    guidance: Canonical<Substitution>,
    answer: &Canonical<ConstrainedSubst>,
) -> Canonical<Substitution> {
    let mut infer = InferenceTable::new();
    let Canonical {
        value: ConstrainedSubst {
            subst: subst1,
            constraints: _,
        },
        binders: _,
    } = answer;

    // Collect the types that the two substitutions have in
    // common.
    let aggr_parameters: Vec<_> = guidance
        .value
        .parameters
        .iter()
        .zip(&subst1.parameters)
        .enumerate()
        .map(|(index, (value, value1))| {
            // We have two values for some variable X that
            // appears in the root goal. Find out the universe
            // of X.
            let universe = root_goal.binders[index].into_inner();

            let ty = match value {
                ParameterKind::Ty(ty) => ty,
                ParameterKind::Lifetime(_) => {
                    // Ignore the lifetimes from the substitution: we're just
                    // creating guidance here anyway.
                    return infer.new_variable(universe).to_lifetime().cast();
                }
            };

            let ty1 = value1.assert_ty_ref();

            // Combine the two types into a new type.
            let mut aggr = AntiUnifier {
                infer: &mut infer,
                universe,
            };
            aggr.aggregate_tys(&ty, ty1).cast()
        })
        .collect();

    let aggr_subst = Substitution {
        parameters: aggr_parameters,
    };

    infer.canonicalize(&aggr_subst).quantified
}
/// Given a current substitution used as guidance for `root_goal`, and
/// a new possible answer to `root_goal`, returns a new set of
/// guidance that encompasses both of them. This is often more general
/// than the old guidance. For example, if we had a guidance of `?0 =
/// u32` and the new answer is `?0 = i32`, then the guidance would
/// become `?0 = ?X` (where `?X` is some fresh variable).
Given a current substitution used as guidance for `root_goal`, and
a new possible answer to `root_goal`, returns a new set of
guidance that encompasses both of them. This is often more general
than the old guidance.
Given a current substitution used as guidance for ` root_goal ` and a new possible answer to ` root_goal ` returns a new set of guidance that encompasses both of them . This is often more general than the old guidance .
fn merge_into_guidance(
    root_goal: &Canonical<InEnvironment<Goal>>,
    guidance: Canonical<Substitution>,
    answer: &Canonical<ConstrainedSubst>,
) -> Canonical<Substitution> {
    let mut infer = InferenceTable::new();
    let Canonical {
        value: ConstrainedSubst {
            subst: subst1,
            constraints: _,
        },
        binders: _,
    } = answer;
    // Collect the types that the two substitutions have in
    // common.
    let aggr_parameters: Vec<_> = guidance
        .value
        .parameters
        .iter()
        .zip(&subst1.parameters)
        .enumerate()
        .map(|(index, (value, value1))| {
            // We have two values for some variable X that
            // appears in the root goal. Find out the universe
            // of X.
            let universe = root_goal.binders[index].into_inner();
            let ty = match value {
                ParameterKind::Ty(ty) => ty,
                ParameterKind::Lifetime(_) => {
                    // Ignore the lifetimes from the substitution: we're just
                    // creating guidance here anyway.
                    return infer.new_variable(universe).to_lifetime().cast();
                }
            };
            let ty1 = value1.assert_ty_ref();
            // Combine the two types into a new type.
            let mut aggr = AntiUnifier {
                infer: &mut infer,
                universe,
            };
            aggr.aggregate_tys(&ty, ty1).cast()
        })
        .collect();
    let aggr_subst = Substitution {
        parameters: aggr_parameters,
    };
    infer.canonicalize(&aggr_subst).quantified
}
fn merge_into_guidance ( root_goal : & Canonical < InEnvironment < Goal > > , guidance : Canonical < Substitution > , answer : & Canonical < ConstrainedSubst > , ) -> Canonical < Substitution > { let mut infer = InferenceTable :: new ( ) ; let Canonical { value : ConstrainedSubst { subst : subst1 , constraints : _ , } , binders : _ , } = answer ; // Collect the types that the two substitutions have in // common. let aggr_parameters : Vec < _ > = guidance . value . parameters . iter ( ) . zip ( & subst1 . parameters ) . enumerate ( ) . map ( | ( index , ( value , value1 ) ) | { // We have two values for some variable X that // appears in the root goal. Find out the universe // of X. let universe = root_goal . binders [ index ] . into_inner ( ) ; let ty = match value { ParameterKind :: Ty ( ty ) => ty , ParameterKind :: Lifetime ( _ ) => { // Ignore the lifetimes from the substitution: we're just // creating guidance here anyway. return infer . new_variable ( universe ) . to_lifetime ( ) . cast ( ) ; } } ; let ty1 = value1 . assert_ty_ref ( ) ; // Combine the two types into a new type. let mut aggr = AntiUnifier { infer : & mut infer , universe , } ; aggr . aggregate_tys ( & ty , ty1 ) . cast ( ) } ) . collect ( ) ; let aggr_subst = Substitution { parameters : aggr_parameters , } ; infer . canonicalize ( & aggr_subst ) . quantified }
Given a current substitution used as guidance for `root_goal`, and
a new possible answer to `root_goal`, returns a new set of
guidance that encompasses both of them.
Given a current substitution used as guidance for ` root_goal ` and a new possible answer to ` root_goal ` returns a new set of guidance that encompasses both of them .
root_goal
&Canonical<InEnvironment<Goal>>
guidance
Canonical<Substitution>
answer
&Canonical<ConstrainedSubst>
root_goal
&Canonical<InEnvironment<Goal>>
guidance
Canonical<Substitution>
answer
&Canonical<ConstrainedSubst>