Skip to content

Commit 1332e72

Browse files
committed
Fix TyBuilder methods
1 parent b24e6f6 commit 1332e72

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/hir_ty/src/builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::iter;
44

55
use chalk_ir::{
66
cast::{Cast, CastTo, Caster},
7+
fold::Fold,
78
interner::HasInterner,
89
AdtId, BoundVar, DebruijnIndex, Safety, Scalar,
910
};
@@ -32,8 +33,7 @@ impl<D> TyBuilder<D> {
3233

3334
fn build_internal(self) -> (D, Substitution) {
3435
assert_eq!(self.vec.len(), self.param_count);
35-
// FIXME: would be good to have a way to construct a chalk_ir::Substitution from the interned form
36-
let subst = Substitution::intern(self.vec);
36+
let subst = Substitution::from_iter(&Interner, self.vec);
3737
(self.data, subst)
3838
}
3939

@@ -141,7 +141,7 @@ impl TyBuilder<hir_def::AdtId> {
141141
self.vec.push(fallback().cast(&Interner));
142142
} else {
143143
// each default can depend on the previous parameters
144-
let subst_so_far = Substitution::intern(self.vec.clone());
144+
let subst_so_far = Substitution::from_iter(&Interner, self.vec.clone());
145145
self.vec
146146
.push(default_ty.clone().substitute(&Interner, &subst_so_far).cast(&Interner));
147147
}
@@ -196,13 +196,13 @@ impl TyBuilder<TypeAliasId> {
196196
}
197197
}
198198

199-
impl<T: TypeWalk + HasInterner<Interner = Interner>> TyBuilder<Binders<T>> {
199+
impl<T: HasInterner<Interner = Interner> + Fold<Interner>> TyBuilder<Binders<T>> {
200200
fn subst_binders(b: Binders<T>) -> Self {
201201
let param_count = b.binders.len(&Interner);
202202
TyBuilder::new(b, param_count)
203203
}
204204

205-
pub fn build(self) -> T {
205+
pub fn build(self) -> <T as Fold<Interner>>::Result {
206206
let (b, subst) = self.build_internal();
207207
b.substitute(&Interner, &subst)
208208
}

0 commit comments

Comments
 (0)