diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-06 08:49:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-06 08:49:09 +0100 |
commit | a93a04fc9e48bdcc9132738c391de77bd25dca7e (patch) | |
tree | 70ad7c87e686111e3d2e150aea08612713b46079 /crates/ra_hir_ty/src/traits.rs | |
parent | 0625c76009d394bf73eb13c3de65304ce4283a1c (diff) | |
parent | 952714685a7c0e0a1c9970839ce307806adaa176 (diff) |
Merge #3744
3744: Upgrade Chalk r=matklad a=flodiebold
Co-authored-by: Florian Diebold <[email protected]>
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index a1ca33c98..07854a062 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -7,7 +7,7 @@ use ra_db::{impl_intern_key, salsa, CrateId}; | |||
7 | use ra_prof::profile; | 7 | use ra_prof::profile; |
8 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
9 | 9 | ||
10 | use crate::db::HirDatabase; | 10 | use crate::{db::HirDatabase, DebruijnIndex}; |
11 | 11 | ||
12 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; | 12 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; |
13 | 13 | ||
@@ -128,7 +128,11 @@ impl TypeWalk for ProjectionPredicate { | |||
128 | self.ty.walk(f); | 128 | self.ty.walk(f); |
129 | } | 129 | } |
130 | 130 | ||
131 | fn walk_mut_binders(&mut self, f: &mut impl FnMut(&mut Ty, usize), binders: usize) { | 131 | fn walk_mut_binders( |
132 | &mut self, | ||
133 | f: &mut impl FnMut(&mut Ty, DebruijnIndex), | ||
134 | binders: DebruijnIndex, | ||
135 | ) { | ||
132 | self.projection_ty.walk_mut_binders(f, binders); | 136 | self.projection_ty.walk_mut_binders(f, binders); |
133 | self.ty.walk_mut_binders(f, binders); | 137 | self.ty.walk_mut_binders(f, binders); |
134 | } | 138 | } |
@@ -144,7 +148,7 @@ pub(crate) fn trait_solve_query( | |||
144 | Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(), | 148 | Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(), |
145 | Obligation::Projection(_) => "projection".to_string(), | 149 | Obligation::Projection(_) => "projection".to_string(), |
146 | }); | 150 | }); |
147 | log::debug!("trait_solve_query({})", goal.value.value.display(db)); | 151 | eprintln!("trait_solve_query({})", goal.value.value.display(db)); |
148 | 152 | ||
149 | if let Obligation::Projection(pred) = &goal.value.value { | 153 | if let Obligation::Projection(pred) = &goal.value.value { |
150 | if let Ty::Bound(_) = &pred.projection_ty.parameters[0] { | 154 | if let Ty::Bound(_) = &pred.projection_ty.parameters[0] { |
@@ -153,7 +157,7 @@ pub(crate) fn trait_solve_query( | |||
153 | } | 157 | } |
154 | } | 158 | } |
155 | 159 | ||
156 | let canonical = goal.to_chalk(db).cast(); | 160 | let canonical = goal.to_chalk(db).cast(&Interner); |
157 | 161 | ||
158 | // We currently don't deal with universes (I think / hope they're not yet | 162 | // We currently don't deal with universes (I think / hope they're not yet |
159 | // relevant for our use cases?) | 163 | // relevant for our use cases?) |
@@ -194,8 +198,8 @@ fn solution_from_chalk( | |||
194 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| { | 198 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| { |
195 | let value = subst | 199 | let value = subst |
196 | .value | 200 | .value |
197 | .into_iter() | 201 | .iter(&Interner) |
198 | .map(|p| match p.ty() { | 202 | .map(|p| match p.ty(&Interner) { |
199 | Some(ty) => from_chalk(db, ty.clone()), | 203 | Some(ty) => from_chalk(db, ty.clone()), |
200 | None => unimplemented!(), | 204 | None => unimplemented!(), |
201 | }) | 205 | }) |