fn apply_solution(&mut self,
                      free_vars: Vec<ParameterInferenceVariable>,
                      subst: Canonical<ConstrainedSubst>)
    {
        let Canonical { value, binders } = subst;
        let ConstrainedSubst { subst, constraints } = self.instantiate(binders, &value);

        debug!("fulfill::apply_solution: adding constraints {:?}", constraints);
        self.constraints.extend(constraints);

        // We use the empty environment for unification here because we're
        // really just doing a substitution on unconstrained variables, which is
        // guaranteed to succeed without generating any new constraints.
        let empty_env = &Environment::new();

        for (i, free_var) in free_vars.into_iter().enumerate() {
            let subst_var = InferenceVariable::from_depth(i);

            // Should always be `Some(..)` unless we applied coinductive semantics
            // somewhere and hence returned an empty substitution.
            if let Some(subst_value) = subst.parameters.get(&subst_var) {
                let free_value = free_var.to_parameter();
                self.unify(empty_env, &free_value, subst_value)
                    .unwrap_or_else(|err| {
                        panic!("apply_solution failed with free_var={:?}, subst_value={:?}: {:?}",
                               free_var, subst_value, err);
                    });
            }
        }
    }
/// Apply the subsitution `subst` to all the variables of `free_vars`
/// (understood in deBruijn style), and add any lifetime constraints.
Apply the subsitution `subst` to all the variables of `free_vars`
(understood in deBruijn style), and add any lifetime constraints.
Apply the subsitution ` subst ` to all the variables of ` free_vars ` ( understood in deBruijn style ) and add any lifetime constraints .
fn apply_solution(&mut self,
                      free_vars: Vec<ParameterInferenceVariable>,
                      subst: Canonical<ConstrainedSubst>)
    {
        let Canonical { value, binders } = subst;
        let ConstrainedSubst { subst, constraints } = self.instantiate(binders, &value);
        debug!("fulfill::apply_solution: adding constraints {:?}", constraints);
        self.constraints.extend(constraints);
        // We use the empty environment for unification here because we're
        // really just doing a substitution on unconstrained variables, which is
        // guaranteed to succeed without generating any new constraints.
        let empty_env = &Environment::new();
        for (i, free_var) in free_vars.into_iter().enumerate() {
            let subst_var = InferenceVariable::from_depth(i);
            // Should always be `Some(..)` unless we applied coinductive semantics
            // somewhere and hence returned an empty substitution.
            if let Some(subst_value) = subst.parameters.get(&subst_var) {
                let free_value = free_var.to_parameter();
                self.unify(empty_env, &free_value, subst_value)
                    .unwrap_or_else(|err| {
                        panic!("apply_solution failed with free_var={:?}, subst_value={:?}: {:?}",
                               free_var, subst_value, err);
                    });
            }
        }
    }
fn apply_solution ( & mut self , free_vars : Vec < ParameterInferenceVariable > , subst : Canonical < ConstrainedSubst > ) { let Canonical { value , binders } = subst ; let ConstrainedSubst { subst , constraints } = self . instantiate ( binders , & value ) ; debug ! ( " " constraints ) ; self . constraints . extend ( constraints ) ; // We use the empty environment for unification here because we're // really just doing a substitution on unconstrained variables, which is // guaranteed to succeed without generating any new constraints. let empty_env = & Environment :: new ( ) ; for ( i , free_var ) in free_vars . into_iter ( ) . enumerate ( ) { let subst_var = InferenceVariable :: from_depth ( i ) ; // Should always be `Some(..)` unless we applied coinductive semantics // somewhere and hence returned an empty substitution. if let Some ( subst_value ) = subst . parameters . get ( & subst_var ) { let free_value = free_var . to_parameter ( ) ; self . unify ( empty_env , & free_value , subst_value ) . unwrap_or_else ( | err | { panic ! ( " " free_var subst_value err ) ; } ) ; } } }
Apply the subsitution `subst` to all the variables of `free_vars`
(understood in deBruijn style), and add any lifetime constraints.
Apply the subsitution ` subst ` to all the variables of ` free_vars ` ( understood in deBruijn style ) and add any lifetime constraints .
&mut self
free_vars
Vec<ParameterInferenceVariable>
subst
Canonical<ConstrainedSubst>