diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 18:25:19 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 18:25:19 +0100 |
commit | c91b5376835ab54cd4bca02953625ef1f1fabeba (patch) | |
tree | 390be0ec3c0a57db5188b06c86f0a7df0242b01c /crates/hir_ty/src/builder.rs | |
parent | 467a5c6cd13af6ccb76e9ebdb35f96fc10fb438f (diff) | |
parent | a316d583600e11ee1fcc8027a838efafe435f03c (diff) |
Merge #8348
8348: Make `Binders` more like Chalk r=flodiebold a=flodiebold
Working towards #8313.
- hide `value`
- use `VariableKinds`
- adjust `subst` to be like Chalk's `substitute`
- also clean up some other `TypeWalk` stuff to prepare for it being replaced by Chalk's `Fold`
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/builder.rs')
-rw-r--r-- | crates/hir_ty/src/builder.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/hir_ty/src/builder.rs b/crates/hir_ty/src/builder.rs index 372621f73..9b2c6975a 100644 --- a/crates/hir_ty/src/builder.rs +++ b/crates/hir_ty/src/builder.rs | |||
@@ -139,7 +139,8 @@ impl TyBuilder<hir_def::AdtId> { | |||
139 | } else { | 139 | } else { |
140 | // each default can depend on the previous parameters | 140 | // each default can depend on the previous parameters |
141 | let subst_so_far = Substitution::intern(self.vec.clone()); | 141 | let subst_so_far = Substitution::intern(self.vec.clone()); |
142 | self.vec.push(default_ty.clone().subst(&subst_so_far).cast(&Interner)); | 142 | self.vec |
143 | .push(default_ty.clone().substitute(&Interner, &subst_so_far).cast(&Interner)); | ||
143 | } | 144 | } |
144 | } | 145 | } |
145 | self | 146 | self |
@@ -194,13 +195,13 @@ impl TyBuilder<TypeAliasId> { | |||
194 | 195 | ||
195 | impl<T: TypeWalk + HasInterner<Interner = Interner>> TyBuilder<Binders<T>> { | 196 | impl<T: TypeWalk + HasInterner<Interner = Interner>> TyBuilder<Binders<T>> { |
196 | fn subst_binders(b: Binders<T>) -> Self { | 197 | fn subst_binders(b: Binders<T>) -> Self { |
197 | let param_count = b.num_binders; | 198 | let param_count = b.binders.len(&Interner); |
198 | TyBuilder::new(b, param_count) | 199 | TyBuilder::new(b, param_count) |
199 | } | 200 | } |
200 | 201 | ||
201 | pub fn build(self) -> T { | 202 | pub fn build(self) -> T { |
202 | let (b, subst) = self.build_internal(); | 203 | let (b, subst) = self.build_internal(); |
203 | b.subst(&subst) | 204 | b.substitute(&Interner, &subst) |
204 | } | 205 | } |
205 | } | 206 | } |
206 | 207 | ||