aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-16 13:17:20 +0000
committerGitHub <[email protected]>2019-11-16 13:17:20 +0000
commit5d9bce6e88626ec5f36b562803686c848fdf7b66 (patch)
tree89f19c9649f8cc60e9e8c35cd50e8c87a0198247 /crates/ra_hir/src/ty/infer
parent7ad44610819d0bc69d4a2e0b9a74672ebb0fd585 (diff)
parentee190388ab9068167f665bec39edd4546336ee3d (diff)
Merge #2274
2274: Chalk upgrade & dyn/impl support r=matklad a=flodiebold - upgrade Chalk, which is a bit more involved than usual this time -- associated type values (in impls) are now a separate entity in Chalk, so we have to intern separate IDs for them... - use Chalk's dyn/impl Trait support - fix our handling of binders/bound variables -- before, we didn't use them for anything except Chalk queries, but now that we use them in dyn/impl Trait types and pass that to Chalk, we have to be a bit more careful Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/infer')
-rw-r--r--crates/ra_hir/src/ty/infer/unify.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs
index ca33cc7f8..64d9394cf 100644
--- a/crates/ra_hir/src/ty/infer/unify.rs
+++ b/crates/ra_hir/src/ty/infer/unify.rs
@@ -134,17 +134,19 @@ where
134} 134}
135 135
136impl<T> Canonicalized<T> { 136impl<T> Canonicalized<T> {
137 pub fn decanonicalize_ty(&self, ty: Ty) -> Ty { 137 pub fn decanonicalize_ty(&self, mut ty: Ty) -> Ty {
138 ty.fold(&mut |ty| match ty { 138 ty.walk_mut_binders(
139 Ty::Bound(idx) => { 139 &mut |ty, binders| match ty {
140 if (idx as usize) < self.free_vars.len() { 140 &mut Ty::Bound(idx) => {
141 Ty::Infer(self.free_vars[idx as usize]) 141 if idx as usize >= binders && (idx as usize - binders) < self.free_vars.len() {
142 } else { 142 *ty = Ty::Infer(self.free_vars[idx as usize - binders]);
143 Ty::Bound(idx) 143 }
144 } 144 }
145 } 145 _ => {}
146 ty => ty, 146 },
147 }) 147 0,
148 );
149 ty
148 } 150 }
149 151
150 pub fn apply_solution( 152 pub fn apply_solution(