Skip to content

Commit

Permalink
Add missing fold_free_var_const
Browse files Browse the repository at this point in the history
  • Loading branch information
HKalbasi committed Mar 12, 2022
1 parent f470f2f commit 291e872
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions chalk-solve/src/clauses/generalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use chalk_ir::{
fold::{Fold, Folder},
interner::{HasInterner, Interner},
Binders, BoundVar, DebruijnIndex, Fallible, Lifetime, LifetimeData, NoSolution, Ty, TyKind,
TyVariableKind, VariableKind, VariableKinds,
Binders, BoundVar, Const, ConstData, ConstValue, DebruijnIndex, Fallible, Lifetime,
LifetimeData, NoSolution, Ty, TyKind, TyVariableKind, VariableKind, VariableKinds,
};
use rustc_hash::FxHashMap;

Expand Down Expand Up @@ -63,6 +63,26 @@ impl<I: Interner> Folder<I> for Generalize<I> {
Ok(TyKind::BoundVar(new_var).intern(self.interner()))
}

fn fold_free_var_const(
&mut self,
ty: Ty<I>,
bound_var: BoundVar,
outer_binder: DebruijnIndex,
) -> Fallible<Const<I>> {
let binder_vec = &mut self.binders;
let new_index = self.mapping.entry(bound_var).or_insert_with(|| {
let i = binder_vec.len();
binder_vec.push(VariableKind::Const(ty.clone()));
i
});
let new_var = BoundVar::new(outer_binder, *new_index);
Ok(ConstData {
ty,
value: ConstValue::BoundVar(new_var),
}
.intern(self.interner()))
}

fn fold_free_var_lifetime(
&mut self,
bound_var: BoundVar,
Expand Down

0 comments on commit 291e872

Please sign in to comment.