fn solve<'a>(&mut self) -> Result<Subst, TypeError> {
        let mut sub = HashMap::<Name, Type>::new();
        // let mut constraints = self.constraints;
        let mut constraints = mem::replace(&mut self.constraints, LinkedList::new());
        // println!("Type constraints: ");
        // println!("{:#?}", constraints);
        let mut step: usize = 1;
        while let Some(cons) = constraints.pop_front() {
            // println!("Type solve step {:?}: ", step);
            let new_sub = cons.unify()?;
            // println!("current unify: ");
            // println!("{:#?}", new_sub);
            for ref mut c in constraints.iter_mut() {
                c.apply_mut(&new_sub);
            }
            sub = sub.into_iter().map(|(k, v)| (k, v.apply(&new_sub))).collect();
            sub.extend(new_sub);
            // println!("Type substituation: ");
            // println!("{:#?}", sub);
            step = step + 1;
        }
        Ok(sub)
    }
/// Solve constraints. This will move out the `Infer` struct.
Solve constraints. This will move out the `Infer` struct.
Solve constraints . This will move out the ` Infer ` struct .
fn solve<'a>(&mut self) -> Result<Subst, TypeError> {
        let mut sub = HashMap::<Name, Type>::new();
        // let mut constraints = self.constraints;
        let mut constraints = mem::replace(&mut self.constraints, LinkedList::new());
        // println!("Type constraints: ");
        // println!("{:#?}", constraints);
        let mut step: usize = 1;
        while let Some(cons) = constraints.pop_front() {
            // println!("Type solve step {:?}: ", step);
            let new_sub = cons.unify()?;
            // println!("current unify: ");
            // println!("{:#?}", new_sub);
            for ref mut c in constraints.iter_mut() {
                c.apply_mut(&new_sub);
            }
            sub = sub.into_iter().map(|(k, v)| (k, v.apply(&new_sub))).collect();
            sub.extend(new_sub);
            // println!("Type substituation: ");
            // println!("{:#?}", sub);
            step = step + 1;
        }
        Ok(sub)
    }
fn solve < ' a > ( & mut self ) -> Result < Subst , TypeError > { let mut sub = HashMap :: < Name , Type > :: new ( ) ; // let mut constraints = self.constraints; let mut constraints = mem :: replace ( & mut self . constraints , LinkedList :: new ( ) ) ; // println!("Type constraints: "); // println!("{:#?}", constraints); let mut step : usize = 1 ; while let Some ( cons ) = constraints . pop_front ( ) { // println!("Type solve step {:?}: ", step); let new_sub = cons . unify ( ) ? ; // println!("current unify: "); // println!("{:#?}", new_sub); for ref mut c in constraints . iter_mut ( ) { c . apply_mut ( & new_sub ) ; } sub = sub . into_iter ( ) . map ( | ( k , v ) | ( k , v . apply ( & new_sub ) ) ) . collect ( ) ; sub . extend ( new_sub ) ; // println!("Type substituation: "); // println!("{:#?}", sub); step = step + 1 ; } Ok ( sub ) }
Solve constraints.
Solve constraints .
&mut self
&mut self