diff options
author | Florian Diebold <[email protected]> | 2019-11-16 11:53:13 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-11-16 12:25:54 +0000 |
commit | 351c29d859d74f7a61e654bdbcad634bfb136225 (patch) | |
tree | 39289f3a5fd0d828780ffa3128317afc8a0598e4 /crates/ra_hir/src/ty/traits.rs | |
parent | 9c2a9a9a0635e53466749fdedcdc5a371e658cde (diff) |
Fix handling of the binders in dyn/impl Trait
We need to be more careful now when substituting bound variables (previously, we
didn't have anything that used bound variables except Chalk, so it was not a
problem).
This is obviously quite ad-hoc; Chalk has more infrastructure for handling this
in a principled way, which we maybe should adopt.
Diffstat (limited to 'crates/ra_hir/src/ty/traits.rs')
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 771525deb..99dbab99e 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -165,9 +165,9 @@ impl TypeWalk for ProjectionPredicate { | |||
165 | self.ty.walk(f); | 165 | self.ty.walk(f); |
166 | } | 166 | } |
167 | 167 | ||
168 | fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { | 168 | fn walk_mut_binders(&mut self, f: &mut impl FnMut(&mut Ty, usize), binders: usize) { |
169 | self.projection_ty.walk_mut(f); | 169 | self.projection_ty.walk_mut_binders(f, binders); |
170 | self.ty.walk_mut(f); | 170 | self.ty.walk_mut_binders(f, binders); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
@@ -188,6 +188,7 @@ pub(crate) fn trait_solve_query( | |||
188 | } | 188 | } |
189 | 189 | ||
190 | let canonical = goal.to_chalk(db).cast(); | 190 | let canonical = goal.to_chalk(db).cast(); |
191 | |||
191 | // We currently don't deal with universes (I think / hope they're not yet | 192 | // We currently don't deal with universes (I think / hope they're not yet |
192 | // relevant for our use cases?) | 193 | // relevant for our use cases?) |
193 | let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; | 194 | let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; |